|
-
Jan 24th, 2006, 03:00 AM
#1
Thread Starter
Hyperactive Member
Using Arrays [resolved]
Hello Everyone!
In a Module I've declared an array ands a counter variable like so:
VB Code:
Public LPProgLoc(9) As String
Public IndLP As Integer
The purpose of this array is to store 10 program locations on the pc. The catch is that I used 2 seperate forms. One to start the programs, and one to browse for the programs.
On my first form I'm trying to use the counter variable like:
VB Code:
Dim LPEditProp As New frmLPEditProp
If RadioButton1.Checked = True Then
IndLP = 0
ElseIf RadioButton2.Checked = True Then
IndLP = 1
End If
If (LPEditProp.ShowDialog() = DialogResult.OK) Then
LPProgLoc(IndLP) = LPEditProp.ofdLPBrowse.FileName
End If
End Sub
But the problem is that it doesn't store all the programs in the array - it just loads the last inserted item.
I want to have 2 different radiobuttons load 2 different programs, instead of 2 different radio buttons loading the same program.
How can I achieve that?
Last edited by GrimmReaper; Jan 24th, 2006 at 06:13 AM.
-
Jan 24th, 2006, 03:29 AM
#2
Re: Using Arrays
I don't quite see what the issue is. As long as you check a different RadioButton each time and select a different file in the OpenFileDialog each time then it should assign the two different file paths to the first two elements.
-
Jan 24th, 2006, 04:26 AM
#3
Thread Starter
Hyperactive Member
Re: Using Arrays
Yes I agree, and that's precisely the issue
When I execute the first selected program, it works, but when I want to execute the second and third etc. programs, it still loads the first.
How do I refer to elements of an array?
-
Jan 24th, 2006, 04:47 AM
#4
PowerPoster
Re: Using Arrays
Hi,
Surely if you are using two forms then the following declaration should be global???
Dim LPEditProp As New frmLPEditProp
Where have you declared it anyway?
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jan 24th, 2006, 06:12 AM
#5
Thread Starter
Hyperactive Member
Re: Using Arrays
 Originally Posted by taxes
Hi,
Surely if you are using two forms then the following declaration should be global???
Dim LPEditProp As New frmLPEditProp
Where have you declared it anyway?
Hello, thanx for the advice, but the form's declaration doesn't necessary have to be global (because the second form won't always be open)
I have managed to resolve my issue, you see, I used classes to create control arrays - The problem was that everything was stored into only one location of the array, so I redimmed the array and in the control array's class's event handler, I set the counter variable to the class' Index value, tested about 25 now, and it gives me my desired results everytime.
Thanx everyone for your input.
I'm getting good at this!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|