0

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
3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by kothaisaravan
0

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 :-)

This question has already been answered. 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.