Results 1 to 12 of 12

Thread: No Control Arrays in VB.NET

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    No Control Arrays in VB.NET

    There are no control arrays in VB.NET !

    Why? I miss it

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    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
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  4. #4

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    I see.

    Another question:

    I am getting a date value as :

    VB Code:
    1. strdob = TextBox4.Text

    Now, when I do a

    VB Code:
    1. 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?

  5. #5
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    try working with the System.DateTime struct
    \m/\m/

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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:
    1. Dim curDate As Date=Date.Now
    2. Msgbox(curDate.ToShortDateString)

  7. #7
    Banned
    Join Date
    Jul 2003
    Location
    New delhi
    Posts
    143
    Dim nowdat As Date=Date.Now
    Messagebox(nowdate.ToShortDateString)

  8. #8
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    didnt Edneeis post the same idea earlier today as the last one?

    edit:
    ps: you need .Show when using " Messagebox " , eg: Messagebox.Show(" stuff to show ")
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  9. #9
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  10. #10

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    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.
    Me too. I can't let go of MsgBox.

    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.

  11. #11
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    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.
    I don't live here any more.

  12. #12
    Lively Member formulav8's Avatar
    Join Date
    Mar 2002
    Location
    Orlando
    Posts
    116
    Good to see that i'm not the only one hooked on Msgbox. Its tough trying to switch over.


    Jason

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width