hi guys just ask what is the code for allowing null values to appear on the textbox

Dim i As Integer
        dg1.DataSource = bs
        i = dg1.CurrentRow.Index
        Patient_Profile.Txtpatient_id.Text = dg1.Item(0, i).Value

tnx guys i already solved it on my own thanks for viewing :)

Hi,

Its very simple,
For Example, Now i want to move the data from gridview to textbox, which may or may not be null value.

In case if its a null value follow the below code:

Textbox1.text=DataGridview1.currentrow.cells(1).value

But this will return an error "Cannot convert null value to string"

So I change this above code,

Textbox1.text=DataGridview1.currentrow.cells(1).value.ToString()

Simple :-)