Click here to Skip to main content
15,893,904 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi all visitors.
I have problem with moving record to next record.
i have 4 buttons( first,previous,next,last).
i used sql bindingsource.when the form loaded, i dont display any data to text box.
and than i want to move the record to next record. but when i click Next Button, it alerts a message "Object not set............).

How can i solve that problem?

(Note: if i fill data to text box at form loaded and move Next, it is ok. but i dont want to fill data at form loaded)

Best Regards,
Posted
Comments
Sergey Alexandrovich Kryukov 20-Jun-11 21:46pm    
Not clear. What do you mean by "record". What events do you handle. Show your code and full exception dump, indicate code lines where it happens, post it. Use "Improve question".
--SA
soeun tony 20-Jun-11 22:22pm    
Thanks for your replied
normally, after we created datasource.it will created one dataset.at that time, when my text box link to field of the table in dataset at form loaded Event, it will display: myTableAdapter.Fill(Me.myDataset.myTable) code automatically.When i open my form, i will see any value on my text box and i also can move next, move last, move first....But for my purpose, i don't want to use myTableAdapter.Fill(Me.myDataset.myTable) at form loaded Event.so if i dont use it, when i open my form. it also don't display any value on text box too.
My purpose is: I don't want to use myTableAdapter.Fill(Me.myDataset.myTable) at form loaded Event but i can move next, move last,move first.......
Best Regards,
Christian Graus 20-Jun-11 23:36pm    
It sounds like you're writing code to iterate over a data source, one record at a time. Edit your post to give us the full error message, and the line of code that gives the error. Some info on what you see when you debug the code would also be helpful. No-one can answer this

Try this link...

http://www.codeproject.com/KB/grid/BindSourceBindingNavCS.aspx
 
Share this answer
 
Solve Problem
by :-Jaysing Chavda
VB
connetionString = "Data Source=SOFT05-PC;Initial Catalog=Demo;User ID=sa;Password=sa123"
        da = New SqlDataAdapter("Select * From Test", connetionString)
        Dim ds As New DataSet
        da.Fill(ds)
        bm = Me.BindingContext(ds, "Demo")
        dr = ds.Tables(0).Rows(ds.Tables(0).Rows.Count - 1)
        TextBox1.Text = dr(0)
        TextBox2.Text = dr(1)
        TextBox3.Text = dr(2)
        TextBox4.Text = dr(3)
        TextBox5.Text = dr(4)
 
Share this answer
 
Solve Problem
by :-Jaysing Chavda
VB
connetionString = "Data Source=SOFT05-PC;Initial Catalog=Demo;User ID=sa;Password=sa123"
        da = New SqlDataAdapter("Select * From Test", connetionString)
        Dim ds As New DataSet
        da.Fill(ds)
        bm = Me.BindingContext(ds, "Demo")
        dr = ds.Tables(0).Rows(ds.Tables(0).Rows.Count - 1)
        TextBox1.Text = dr(0)
        TextBox2.Text = dr(1)
        TextBox3.Text = dr(2)
        TextBox4.Text = dr(3)
        TextBox5.Text = dr(4)
 
Share this answer
 
If you Google it, you might find some answers.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900