|
I am trying to add a month view calendar that will display the time and description of the event within each day (using VB.NET 2005). My current attemt is to draw a series of rectangles and place text within each. I am able to create my calendar, put the day inside each box...so the calendar is there. My problem is placing a label, text, etc. within each box to display the event. I would also need to be able to double-click the item and open a form containg the detail for the item. If someone could point me in the right direction (even if it means starting over and taking a new path) I would greatly appreciate it.
Many thanks in advance.
-- modified at 21:55 Monday 16th October, 2006
|
|
|
|
|
You can create them dynamically in code. Declare the label outside of any subs using the "WithEvents" keyword - this will allow you to attach a double-click event to the label through making use of the AddHandler method.
You will have to add your own code to determine how many labels you'll need, I've just used a loop to demonstrate.
Private WithEvents lblEvent As Label
Private Sub MySub()'dynamically add labels
Dim i As Integer
Do Until i = 30
lblEvent = New Label
lblEvent.Text = "Event Label " & i.ToString
AddHandler lblEvent.DoubleClick, AddressOf lblEvent_DoubleClick
'add the label to a control
Me.Controls.Add(lblEvent)
Loop
End Sub
Private Sub lblEvent_DoubleClick(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles lblEvent.DoubleClick
'add processing here
End Sub
|
|
|
|
|
i ve an FTP connection. I need the program to check on the FTP connection , and if it doesnt connects within 15 mins terminate the connection,
How can this be performed for System.Net.Sockets
Thanks
harsh
|
|
|
|
|
What do you "in 15 minutes"?? Are you writing the server or the client portion? If server, are you referring to waiting only 15 minutes for a connection from an FTP Client app?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
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
|
|
|
|