Solved

scope of declaration

Posted on 2004-04-18
3
241 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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
Sending receiving text messages in vb.net 15 63
vb.net class 3 31
Need help with a query 14 40
How can I add google maps in vb.net. 2 24
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 …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

697 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