I use the below code to auto scroll listbox items and work well.
I want to be able to scroll all the cells in column no 2 of the gridview order wise but I am not able to do it. I am using the listed code with the help of timer control.
What I have tried:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If multinumbers.ListBox6.SelectedIndex < multinumbers.ListBox6.Items.Count - 1 Then
multinumbers.ListBox6.SelectedIndex += 1 'Highlight the next one in the list
SendSMS() 'Send a message to the new number
Else
Timer1.Stop()
multinumbers.Label101.Text = "Your Message has Completed" 'Let the user know we're done
MsgBox("Your Desired List has Completed.Now you can Create New List of New Numbers or Send again Message to previous Numbers !")
multinumbers.Button7.Enabled = False
multinumbers.Button12.Enabled = True
multinumbers.Button2.Enabled = False
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'i want to check first row and cell value in datagridview
DataGridView1.CurrentRow.Cells(1).Selected = True
'Highlight the next one in the gridview row and check cell value
If DataGridView1.CurrentRow.Index < DataGridView1.Rows.Count - 1 Then
DataGridView1.CurrentRow.Cells(0).Selected += 1
Dim myRegExp As RegExp
Dim myMatches As MatchCollection
Dim myMatch As Match
myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern = "(http|https|ftp|html)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*/*.html+"
myMatches = myRegExp.Execute((DataGridView1.CurrentRow.Cells(1).Value.ToString))
For Each myMatch In myMatches
ListBox1.Items.Add(myMatch.Value)
Next
End If
End Sub
More code but faild..............
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim strSearchString As String
Dim myRegExp As RegExp
Dim myMatches As MatchCollection
Dim myMatch As Match
myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
For Each myRow As DataGridViewRow In DataGridView1.Rows
For Each myCell As DataGridViewCell In myRow.Cells
If myRow.Index < DataGridView1.Rows.Count Then
DataGridView1.FirstDisplayedScrollingRowIndex = myRow.Index
strSearchString = myCell.Value.ToString
myRegExp.Pattern = "(http|https|ftp|html)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*/*.html+"
myMatches = myRegExp.Execute((strSearchString))
If InStr(myCell.Value.ToString, strSearchString, CompareMethod.Text) Then
myRow.Selected = True
For Each myMatch In myMatches
ListBox1.Items.Add(myMatch.Value)
Next
End If
End If
Next
Next
End Sub