Format datagrid rows based on InStr contents of list control?

K

Kathy Burke

Hi, will try to make this short and clear!

(1) I have a list control which is populated by strings as follows
(leaving out declarations, etc., for brevity):

Dim strListItem As String = "GRN: " & UCase(txtGRN.Text) & " -- PN: " &
UCase(txtPartNo.Text)

If Trim(txtPartNo.Text) = "" Then
Exit Sub
End If

If Trim(txtGRN.Text) = "" Then
Exit Sub
End If

lItem = Me.lstPartNumbers.Items.FindByText(strListItem)

If lItem Is Nothing Then
Me.lstPartNumbers.Items.Add(New ListItem(strListItem))

(2) I have a simple datagrid containing the "parts" to be entered via
the above text boxes (txtGRN and txtPartNo).

As each strListItem is entered, I would like to rebind the parts
datagrid, coloring each row added to the list control grey, to indicate
this part has been entered.

I have the basic code for the formatting:

Sub SetRowColor(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
'Check to see if the part string is in the list,

???

End Sub

...but can't quite figure out how to examine each row to see if the
PartNo is contained in the list control items. Each list item being a
concatenated string of two fields txtGRN and txtPartNo. I was thinking
InStr of some sort, but now getting lost. Below is the basic code I dug
up, any help to finish would be appreciated, as always.

Thanks,

Kathy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top