Hello all i am having a problem accessing my controls from my class. I did quite a bit of research and I'm using delegates but i still seem to be having a problem.
When I run my program first thing i do is load a txt file into my listbox "lbWordlist" Here: (form1.vb)
At the bottom of that function I insert a breakpoint and tbWordlist.Max is set to 3407 (tbWordlist is my trackbar to keep track of my position in my wordlist).
Also in my form1.vb is the public get property i have here:
Here i use a function delegate (otherwise crossthreading error) And here is the function.
Now I get an error at:
tmp = lbWordlist.Items.Item(tbWordlist.Value - 1)
in here saying
argumentoutofrangeexception
"InvalidArgument=Value of '0' is not valid for 'index'."
when there is a listcount of 3047 and also my tbWordlist.maximum is set back to 1 when it should be 3047 because i just loaded the wordlist into it and thats what the count was on my previous breakpoint in btnLoadWord.
Now is there anyone that can help me out here? Sorry i tried to make my problem as clear as possible. Thanks in advance
When I run my program first thing i do is load a txt file into my listbox "lbWordlist" Here: (form1.vb)
VB.NET:
Private Sub btnLoadWord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadWord.Click
lbWordlist.Items.Clear()
With OpenFileDialog1
.Title = "Select Your WordList..."
.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
lbWordlist.Items.AddRange(Split(My.Computer.FileSystem.ReadAllText(.FileName), vbNewLine))
End If
Me.tbWordlist.Maximum = lbWordlist.Items.Count
End With
End Sub
Also in my form1.vb is the public get property i have here:
VB.NET:
Delegate Function GetComboCallBack() As String
VB.NET:
Public ReadOnly Property GetCombo() As String
Get
Dim d As New GetComboCallBack(AddressOf GetTheCombo)
Return d.Invoke()
End Get
End Property
VB.NET:
Public Function GetTheCombo() As String
Dim tmp As String
tmp = lbWordlist.Items.Item(tbWordlist.Value - 1)
If tbWordlist.Value = tbWordlist.Maximum Then
StopBots = True
Else
tbWordlist.Value += 1
End If
Return tmp
End Function
tmp = lbWordlist.Items.Item(tbWordlist.Value - 1)
in here saying
argumentoutofrangeexception
"InvalidArgument=Value of '0' is not valid for 'index'."
when there is a listcount of 3047 and also my tbWordlist.maximum is set back to 1 when it should be 3047 because i just loaded the wordlist into it and thats what the count was on my previous breakpoint in btnLoadWord.
Now is there anyone that can help me out here? Sorry i tried to make my problem as clear as possible. Thanks in advance