Solved

scope of declaration

Posted on 2004-04-18
3
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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