Results 1 to 11 of 11

Thread: Radio button list problem

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    Re: Radio button list problem

    Ohh, thank you very very much! You've helped me with a lot questions now I have a one more que. Whats the difference between Dim rb as List(of RadioButton), and Private rb as new List(Of RadioButtons)? So why did you told me to use Private instead of Dim?

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,110

    Re: Radio button list problem

    Quote Originally Posted by Daveeed View Post
    Ohh, thank you very very much! You've helped me with a lot questions now I have a one more que. Whats the difference between Dim rb as List(of RadioButton), and Private rb as new List(Of RadioButtons)? So why did you told me to use Private instead of Dim?
    In this case, there is no difference at all that I can point to. Some people have suggested that Dim could be treated as either Private or Public, depending on the situation, but I don't know whether or not that's true.

    As a general rule, Dim is used for local variables (you don't get a choice), and either Public, Private, or Protected (that last one is quite rare) are used for variables outside of methods. You don't HAVE to do that, but if Dim can mean different things in different places, then Public and Private are just more explicit. There certainly isn't any harm to using Dim. I have an application that did that for all form level variables (the code was generated, not written), and I've never found any negative consequence from that.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    Re: Radio button list problem

    I've replaced the list to this
    Code:
        Private rb(4) As RadioButton
    , but it gives me again the same error,
    Code:
    Additional information: Object reference not set to an instance of an object.
    , at the line
    Code:
    rb(1).Location = vb1.Location
    . Now, everythings should be okay, whats the problem again?

Tags for this Thread

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