Solved

scope of declaration

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now