There are no control arrays in VB.NET !
Why? I miss it :cry:
Printable View
There are no control arrays in VB.NET !
Why? I miss it :cry:
We had a vote and the tribe has spoken.
Actually this is a common worry when moving from VB6 but don't worry .NET has the Add/RemoveHandler methods or Handles keyword which are far better than control arrays. You can grab events from multiple object even if they aren't the same type of control/object now with them. You can also catch events dynamically for new objects like in a control array. It just takes some getting used to thats all.
you can create " virtual " control arrays, by adding handlers to deal with them , eg: if you had 5 buttons , you could make them all handled by one sub and asign them with unique tag values, then in that sub when one of the buttons is pressed, use the tag property in the same way as the index property of vb6.
edit : omg beaten to the post again, must be all the lack of sleep slowing me down:p
I see.
Another question:
I am getting a date value as :
VB Code:
strdob = TextBox4.Text
Now, when I do a
VB Code:
dtdateofbirth = CDate(strdob)
I am getting the date along with a time value there. I want to get rid of this time value, but I want to retain the Date type of the variable dtdateofbirth.
Any ideas?
try working with the System.DateTime struct
All dates are actually a date time set by default you can just show it as a date to get what you want. There are various ToShortDateString, ToLongDateString, ToThisOrThatString... methods to format it or you can use your own simliar to VB6's Format Function.
VB Code:
Dim curDate As Date=Date.Now Msgbox(curDate.ToShortDateString)
Dim nowdat As Date=Date.Now
Messagebox(nowdate.ToShortDateString)
didnt Edneeis post the same idea earlier today as the last one? :rolleyes:
edit:
ps: you need .Show when using " Messagebox " , eg: Messagebox.Show(" stuff to show ") ;)
I'm guilty of still using Msgbox instead of the more proper MessageBox, but I love MsgBox.
My name is Ed Marquez and I'm a MsgBox-aholic.
:(
Me too. :( I can't let go of MsgBox.Quote:
Originally posted by Edneeis
I'm guilty of still using Msgbox instead of the more proper MessageBox, but I love MsgBox.
My name is Ed Marquez and I'm a MsgBox-aholic.
:(
Anyways, the .ToShortDateString method converts it into a string with the format I want. I guess that any and all date variables will always hold a time value in it as well, and I'll have to convert them to string whenever I want to display them, JA.
Counselling is available to MsgBoxaholics. Contact your local YMCA (Young Messagebox Coder's Association).
Its fun to stay there and you can do anything, apparently.
Good to see that i'm not the only one hooked on Msgbox. Its tough trying to switch over.
Jason