|
i want the program to try for 15 minutes for establishing a connection. even after 15 mins Connection is not established, the attempt shd be aborted.
|
|
|
|
|
This should do it:
<br />
ConnectTimer.Interval = "900000" '15 minutes<br />
If System.Net.Sockets.SocketInformationOptions.Listening Then<br />
ConnectTimer.Enabled = True<br />
Else<br />
ConnectTimer.Enabled = False<br />
End If<br />
<br />
Private Sub ConnectTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConnectTimer.Tick<br />
Dim Shutdown As SocketShutdown<br />
Dim DisConnectNet As TransmitFileOptions<br />
Shutdown= Net.Sockets.SocketShutdown.Both<br />
DisConnectNet = TransmitFileOptions.Disconnect<br />
End Sub<br />
|
|
|
|
|
hi,
When i used " System.Net.Sockets.SocketInformationOptions.Listening" in my code its is showing error that:: SocketInformationOptions is not a member of Sockets.
|
|
|
|
|
Ok. Try using this:
<br />
Dim Listen As SocketInformationOptions<br />
If Listen = Net.Sockets.SocketInformationOptions.Listening Then<br />
'Code Goes Here<br />
End If<br />
If this doesn't work, try inserting Imports System.Net.Sockets into the very top of your code above the beginning of your Class.
-- modified at 18:25 Monday 16th October, 2006
|
|
|
|
|
i found that this enumeration is new in the .NET Framework version 2.0.
i was using .net 1.1 .
sorry i didnt inform this earlier.
is there any option in .net 1.1 which is equivalent.
|
|
|
|
|
No, you cannot use System.Net.Sockets or anything Similar in .Net 1.1. You could try (if you use Vb6) downloading Visual Basic Studio 2005 Express and getting the .Net Framework 2.0 along with it. Otherwise, you probably won't be able to finish you're project.
Sorry.
|
|
|
|
|
I am a newbie in learning vb.net. Hope any would give me a hand of the problem. Here is the problem, i need to get all the data inside the listbox ad update to database. So, i use a for loop to save into database. But the data in the listbox can't be retrieved. I am very frustrated with this any help would be appreciated. Thanks.
Dim i As Integer = 1
Dim j As Integer = lbStockID.Items.Count - 1
For i = 1 To j
Dim stockcode As String = lbStockID.Items.Item(i)
Dim quantity As string = lbQuantity.Items.Item(i)
//Establish connection
Dim ConnInsSalesD As New SqlConnection("Password=''; Persist Security Info=True;User ID='sa';Initial Catalog=FYP;Data Source='.'")
Dim strInsSalesD As String
strInsSalesD = "Insert into SalesDetails Values('" & SDID & "','" & quantity & "','" & lblSID.Text & "','" & stockcode & "')"
ConnInsSalesD.Open()
Dim cmdInsSalesD As New SqlCommand(strInsSalesD, ConnInsSalesD)
cmdInsSalesD.ExecuteNonQuery()
ConnInsSalesD.Close()
Next i
|
|
|
|
|
What's the problem? "But the data in the listbox can't be retrieved" doesn't tell us anything. Does it work on one line and not the other? Does it retrieve the wrong value? Were there any error messages?
Your code says that there are TWO ListBoxes, not one. Is this correct?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks for reply.
Yes, actually i need to store all the data from both listbox into the database, but the both line
Dim stockcode As String = lbStockID.Items.Item(i)
Dim quantity As string = lbQuantity.Items.Item(i)
give me the error message : Value of type 'System.Web.UI.WebControls.ListItem' cannot be converted to 'String'.
So what is the way to solve can i have way to get the data?
Thanks
|
|
|
|
|
Newbie_dydy85 wrote: lbStockID.Items.Item(i)
returns a ListItem and you are assigning it to a string. Use lbStockID.Items.Item(i).Text OR lbStockID.Items.Item(i).Value (as the case maybe) for both drop downs and that should solve the problem.
Shreekar
http://shreekarishere.blogspot.com
|
|
|
|
|
When you return the item from the ListBox, you have to call that objects .ToString() method, if there is one.
But, since your filling the ListBox with items, you shouldn't even need to get it from the ListBox. You already have the items stored somewhere else, right?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Been searching the web for a couple hours now with no luck. Does anyone know of any good sites that show implementing SSL with VB?
|
|
|
|
|
|
I have a class, class A. Within that class are defined multiple properties. (Gets and Sets). In the same project, I have a second class file, Class B. Class A's properties are public, but I am unable to access them from Class B, and when I try to pass Class A into Class B, it doesnt allow it, saying "Class A is a type and cannot be used as an expression". Not sure what I need to do to make Class A Accessible within Class B. Can anyone point me to where I need to go?
Thanks
|
|
|
|
|
What you need to do is post code. Best guess - you are trying to access them as ClassA.SomeProperty when they are not static. YOu need a class instance ( which holds the value for thqat instance only ) or to make them static ( which I think is Shared in VB )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Here is what I have, in Class A:
<microsoft.visualbasic.comclass()>Public Class ClassA
Private Shared propName As String
Public Shared Property strPropName() As String
Get
Return propName
End Get
Set(ByVal value As String)
propName = value
End Set
End Property
End Class
That will allow me to access it as a property directly within another class. (Thanks) However, these properties are set from a VB6 application, which then calls different methods within Class B. I can access the properties in Class B now, but they are not visible in the VB6 app anymore. I have the project setup for Com Interop, and can see everything else, just not the properties I set this way. Am I stuck with one or the other? Or is there a way to get both? I found that if I change the Public Shared Property to just Public Property, I can see it in the vb6 app, but not in the other classes within the project.
|
|
|
|
|
rahvyn6 wrote: Or is there a way to get both? I found that if I change the Public Shared Property to just Public Property, I can see it in the vb6 app, but not in the other classes within the project.
Sounds like you can have one or the other.
There's no way to do it without having something shared at some point.
One possible hack is to have a non shared property which, when called, sets or gets the shared one. So, you have a non shared property, which turns out to really be shared.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
That would be a major pain, I have around 150 properties.
|
|
|
|
|
Sure - I'm afraid I have no other suggestions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
I want to know that how i get hdd serial no by codding in vb.net PLZ help me.
Thak You
Vikash Yadav
|
|
|
|
|
You need to use WMI to do this, and you also need admin access when your code is running.
There's plenty of examples on the web.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi I want how design salary slip data base in ms access and also please give me example project if possible in VB.Net
|
|
|
|
|
What is is that you have problems with; designing a database in Access, or the specific design of a "salary slip" database?
---
b { font-weight: normal; }
|
|
|
|
|
My Question is how we design the database for example just take the employee details and calculate his salary based on no of attended days . if particular employee get hike that also i have to calculate and then i want to show in view screen and then i display in crystal report.if i want to see all the employee details that also i will able to see .Back end is Ms Access and front end is VB.Net please Help me .
|
|
|
|