arrays - VB.net Index Out Of Range Exception -
This program loads. Txt divides it by ":", takes everyone and checks them somewhere. Here my code is reached by the end of the list.
Private sub-Button5_Click (This is System.Object In the form of E. System.EventArgs, Handle Button5.Click then ListBox1.Items.Count = 0 then MsgBox ("Checking") Other Listbox 1. Items.Connect ToString & gt; 0 then strings are str strrr () as strings str = ListBox1.Items (0) strArr = str.Split (":") in the form of str str.Count & gt; 0 then WebBrowser1.Document.GetElementById ("Email"). SetAttribute ("value", (strArr (0)) WebBrowser1.Document.GetElementById ("password"). SetAttribute ("value", (strArr (1)) WebBrowser1.Document.GetElementById ("Access form-contBtn"). InvokeMember ("click") WaitForPageLoad () Threading.Thread.Sleep (5000) Me.Button2.PerformClick () Otherwise the end of the MsgBox ("Full"), then End End Sub
In addition The Me.Button2.PerformClick () button clicks the program and then the button has two clicks this button and it should continue until the listbox is empty, but it only gives error / error
Here is the error
This button lists OpenFileDialog1.InitialDirectory = "./" OpenFileDialog1.FileName = "Open a text file ..." ImportFileDialog1 imports the list .Filter = "t Quote Files (* .txt) | * .txt "OpenFileDialog1.ShowDialog ()
Red R New IO.StreamReader (OpenFileDialog1.FileName) as the default string1 string () as in = R.ReadToEnd (). Split (new string (Environment.NewLine, StringSplitOptions.RemoveEmptyEntries)) ListBox1.Items.AddRange (string1) R.Close () ListBox 1. Selected ITem = ListBox1.Items (0) In the form of retarded string string strArr () string str = ListBox1. Selected ITem strArr = str.Split (":") limits imported combo list Label4.Text = (strarr (0)) 'email label 3 Text = (strarr (1)) 'password label 6. Text = (list box 1. item count) How big is a combo?
You split str
into stratr str.Count
str = ListBox1.Items (0) strArr = str.Split (":") if strarr.Count & gt; 0 then ....
The index code of the following code uses index 0 and index 1 so that
if strArr.Count & gt; ; 1 then
Comments
Post a Comment