Results 1 to 4 of 4

Thread: array of numericUpDowns?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    southwest pennsylvania
    Posts
    65

    array of numericUpDowns?

    i keep getting this error that says object reference not set to an instance of an object. why?


    Dim NUDs() As NumericUpDown = {nudHam, nudNuts, _
    nudFruit, nudSpread, nudCandy, nudCookie, nudAnimal}

    Sub setMax(ByVal i As Integer)
    Dim size As Integer
    If radSmall.Checked Then size = 80 Else size = 160
    NUDs(i).Maximum = Weights(i) \ size
    End Sub
    if you choose not to decide you still have made a choice!

    RUSH rocks!

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: array of numericUpDowns?

    Originally posted by joeframbach
    i keep getting this error that says object reference not set to an instance of an object. why?

    Dim NUDs() As NumericUpDown = {nudHam, nudNuts, _
    nudFruit, nudSpread, nudCandy, nudCookie, nudAnimal}

    Sub setMax(ByVal i As Integer)
    Dim size As Integer
    If radSmall.Checked Then size = 80 Else size = 160
    NUDs(i).Maximum = Weights(i) \ size
    End Sub
    Did you try this ??
    VB Code:
    1. Dim NUDs() As New NumericUpDown = {nudHam, nudNuts, _
    2.     nudFruit, nudSpread, nudCandy, nudCookie, nudAnimal}

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    southwest pennsylvania
    Posts
    65
    arrays cannot be declared with keyword New...?
    if you choose not to decide you still have made a choice!

    RUSH rocks!

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I don't think so .It's static method .So you don't have to declare it like so .

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