Click here to Skip to main content
15,881,381 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Drag and Drop DatagridViewCell Pin
bellatriks28-Apr-15 22:49
bellatriks28-Apr-15 22:49 
QuestionList of, Delete records before and after date range. Pin
jkirkerx28-Apr-15 10:25
professionaljkirkerx28-Apr-15 10:25 
AnswerRe: List of, Delete records before and after date range. Pin
Sascha Lefèvre28-Apr-15 10:50
professionalSascha Lefèvre28-Apr-15 10:50 
GeneralRe: List of, Delete records before and after date range. Pin
jkirkerx28-Apr-15 11:45
professionaljkirkerx28-Apr-15 11:45 
GeneralRe: List of, Delete records before and after date range. Pin
Sascha Lefèvre28-Apr-15 12:16
professionalSascha Lefèvre28-Apr-15 12:16 
QuestionRDLC Expression for Address in textbox Pin
jkirkerx27-Apr-15 9:46
professionaljkirkerx27-Apr-15 9:46 
AnswerRe: RDLC Expression for Address in textbox Pin
jkirkerx27-Apr-15 10:45
professionaljkirkerx27-Apr-15 10:45 
QuestionFinding the index of a Listbox item, based on search criteria. VB6 Pin
EdwardX227-Apr-15 6:25
EdwardX227-Apr-15 6:25 
I'm struggling with a simple task of finding the Index of a line in a Listbox based on the first two characters of the string, Listbox line item.

My best code finds the index of the last item, not the item containing the specified search string.
VB
Private Sub Command1_Click()
Dim find As String, i As Long, found As Boolean
find = "0,3"

For i = 0 To List1.ListCount - 1
    If StrComp(find, List1.List(i), vbTextCompare) = 0 Then
        found = True
        List1.SetFocus
        List1.ListIndex = i
        Exit For
    End If
Next
MsgBox " Index # is: " & i 
End Sub


Sample Listbox lines: ("-" indicates a space, forum wouln't display spaces)
0,0 - Item one - Item two - 4/27/2015 9:15:00 AM
0,3 - Item one - Item two - 4/27/2015 9:25:00 AM
0,1 - Item one - Item two - 4/27/2015 10:15:00 AM
0,2 - Item one - Item two - 4/27/2015 10:25:00 AM

So the result of the above is: 4, not 2. My attempts at using 'Left' haven't worked.

Any advice appreciated.
AnswerRe: Finding the index of a Listbox item, based on search criteria. VB6 Pin
Richard MacCutchan27-Apr-15 7:04
mveRichard MacCutchan27-Apr-15 7:04 
GeneralRe: Finding the index of a Listbox item, based on search criteria. VB6 Pin
EdwardX227-Apr-15 12:49
EdwardX227-Apr-15 12:49 
GeneralRe: Finding the index of a Listbox item, based on search criteria. VB6 Pin
Sascha Lefèvre27-Apr-15 15:00
professionalSascha Lefèvre27-Apr-15 15:00 
Questionerror when i run my application Pin
Member 1163064825-Apr-15 5:25
Member 1163064825-Apr-15 5:25 
SuggestionRe: error when i run my application Pin
Richard MacCutchan25-Apr-15 6:42
mveRichard MacCutchan25-Apr-15 6:42 
AnswerRe: error when i run my application Pin
Dave Kreskowiak25-Apr-15 10:54
mveDave Kreskowiak25-Apr-15 10:54 
QuestionRun an exe in MDI_Form Pin
bellatriks24-Apr-15 22:35
bellatriks24-Apr-15 22:35 
AnswerRe: Run an exe in MDI_Form Pin
Dave Kreskowiak25-Apr-15 4:06
mveDave Kreskowiak25-Apr-15 4:06 
QuestionPartial public Sub ??? Pin
satc22-Apr-15 9:41
satc22-Apr-15 9:41 
AnswerRe: Partial public Sub ??? Pin
Sascha Lefèvre22-Apr-15 10:16
professionalSascha Lefèvre22-Apr-15 10:16 
QuestionDataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt22-Apr-15 3:06
Johan Hakkesteegt22-Apr-15 3:06 
AnswerRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Dave Kreskowiak22-Apr-15 4:15
mveDave Kreskowiak22-Apr-15 4:15 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt22-Apr-15 20:26
Johan Hakkesteegt22-Apr-15 20:26 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt22-Apr-15 21:21
Johan Hakkesteegt22-Apr-15 21:21 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Dave Kreskowiak23-Apr-15 2:20
mveDave Kreskowiak23-Apr-15 2:20 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Johan Hakkesteegt23-Apr-15 3:46
Johan Hakkesteegt23-Apr-15 3:46 
GeneralRe: DataGridView.Column("name").DefaultCellStyle.Format applied to all columns (it shouldn't be) Pin
Dave Kreskowiak23-Apr-15 4:05
mveDave Kreskowiak23-Apr-15 4:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.