Solved

scope of declaration

Posted on 2004-04-18
3
240 Views
Last Modified: 2010-04-24
I have declared a hashtable to use with the form like this:

********************
Public Class Form1
    Inherits System.Windows.Forms.Form

   dim htCarrierIndex As New Hashtable()
********************

Okay, so during form_load I populate the hashtable, and it works fine.
Like: MsgBox(htCarrierIndex(0)) returns the value at the 0 key.  Great.

But after form_load, it doesn't work anymore.
MsgBox(Form1.htCarrierIndex(0)) gives me no value.  I've tried dim, public, shared.  What gives?

Thanks in advance.


0
Comment
Question by:scator
  • 2
3 Comments
 

Author Comment

by:scator
ID: 10854031
maybe it's NOT fine--

******************************
For j = 0 To datatable.Rows.Count - 1
            result = datatable.Rows(j)
            'adding cboindex, carrierindex as key/value pair
            htCarrierIndex.Add(j, "hello")
            'htCarrierIndex.Add(j, result(0))
            cboCarrier.Items.Add(result(1))
            MsgBox(htCarrierIndex(0))

           
        Next
        MsgBox(htCarrierIndex(0))
**************************

during the loop, the msgbox displays the value.  outside the loop (the second msgbox) no value is displayed.  very confusing
0
 

Author Comment

by:scator
ID: 10854053
Okay folks.  I am changing this question to:

HOW DO I DELETE THIS QUESTION (WHICH IS WRONG) THAT I POSTED TWO MNUTES AGO?

Thanks
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 125 total points
ID: 10854248
post a 0 point request to Community Support to have the question deleted.

AW
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.net Move a class from Solution Items to a project 2 33
export data table to excel in vb.net 10 36
VB.NET 2008 Publish Error 2 34
Vb.net threads keep increasing 2 36
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question