0

i made a form with datagridview which get its values from excel file and make some changes on its columns to prepare it to be saved in sql database

so i need your help to compare one datagridview column with listbox items and get the result in another column for example in datagridview column value "MR Naveed" and my listbox "MR Naveed" is "MN" i need to check every "Mr Naveed" to be "MN" i made this code

Dim s As String
s = ListBox1.FindStringExact(DataGridView1.Rows(i).Cells(4).Value)
DataGridView1.Rows(i).Cells(9).Value = s

it works but the result is the value array like 0,1,2 in the listbox but i need the name
please i need your help

Edited by Reverend Jim: Corrected code formatting

1
Contributor
1
Reply
23
Views
1 Year
Discussion Span
Last Post by computer_man
0

explan.png
OK .. I have another datagridview connected with sql database with the same values can we make the compare between the two datagridviews

check if the datagridview1.row(i).cells(4).value ' in database (users) column name (username) = datagridview2.row(j).cells(1).value ' in database users column name (shortname) then

datagridview1.row(i).cells(9).value = 'the shortname column value in database or datagridview2.row(j).cells(2).value

can we make something like that !!!!
Thanks for help

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.