Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I have a problem showing an value from a hashtable

 

Here is how I fill it up

      Do While dr.Read()
       hsCat.Add(i, "Test")

       i += 1
     Loop

 

And here is how I try to read it

  Public Sub VulIn(ByVal pos As Integer)
     If (pos > -1) Then
       txtText.text = hsCat.Item(pos)

     End If
 End Sub

 

But that won't work because a conversion fromSystem.Object To Integer is not allowed when Option Strict On

 

Any help?

  • Administrators
Posted

Are you sure it is complaining that it cannot convert from object to integer? I would have expected it to fail converting from Object to String when assigning to the textbox but that could be fixed by

txtText.Text = hsCat.Item(5).ToString()

 

If it really is failing on converting to an integer on which line is the error occurring?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...