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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.