hi!
I've been trying to debug this problem by myself but I'm running out of time figuring it out... what I'm trying to do is I want to bind the textboxes to different fields in my table...sounds simple right? Well, I thought so too. Take a look at my code...
VB Code:
Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click Try ds.Clear() daDoc.Fill(ds, "QuoteDoc") daTran.Fill(ds, "QuoteTran") ds.Relations.Add("DocTran", ds.Tables!QuoteDoc.Columns!Reference, ds.Tables!QuoteTran.Columns!Reference) txtRef.DataBindings.Add("Text", ds.Tables!QuoteDoc, "Reference") dtpQuote.DataBindings.Add("Text", ds.Tables!QuoteDoc, "QuoteDate") cmbTerms.DataBindings.Add("Text", ds.Tables!QuoteDoc, "TermsID") txtCustomer.DataBindings.Add("Text", ds.Tables!QuoteDoc, "CustomerID") txtdiscount.DataBindings.Add("Text", ds, "QuoteDoc.Discount") txtdiscount.DataBindings.Add("Text", ds.Tables!QuoteDoc, "Discount") \\when I inserted this code, I get an error txtspldiscount.DataBindings.Add("Text", ds.Tables!QuoteDoc, "SplDiscount") \\This line also produced the error txtgrand.DataBindings.Add("Text", ds.Tables!QuoteDoc, "QuoteTotal") DataGrid1.DataSource = ds.Tables!QuoteDoc DataGrid1.DataMember = "DocTran" cm = CType(Me.BindingContext(ds.Tables!QuoteDoc), CurrencyManager) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OKOnly, "Error") End Try btnFirst.Enabled = True btnnext.Enabled = True btnprevious.Enabled = True btnnext.Enabled = True btnlast.Enabled = True
I'm completely confused why I can't bind the two textboxes. Please help! Whenever I click on the Find button this is the error I get...
"Data cannot be read from a Datagrid which is not bound to a DataTable."




Reply With Quote