473,385 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Databindings help

Hi all,

I haven't received any replies to a previous question I posted regarding
problems I was having with databound textboxes.. so I'll try a different
angle...

Can anyone point me in the direction of.. or give me some good examples of
databinding of a dataset/table to textboxes in a windows form using CODE -
being assigned at runtime.

I can establish a connection, dataadaptor, dataset all at runtime, and if I
can assign the datasource value of a datagrid, but I can't find any examples
of databound textboxes - these use databindings, and all the items I've
found on these assume you are assigning the datasource at design-time in the
IDE.

I have half the day trying to resolve this - moving from VB6 to .NET is
proving expensive and time-consuming.. any ideas would be greatly
appreciated...

Thanks,
Graham


Nov 20 '05 #1
6 1213
Hi,

Dim strConn As String
Dim strSQL As String
Dim da As OleDbDataAdapter

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
strConn &= "Data Source = Northwind.mdb;"
conn = New OleDbConnection(strConn)
da = New OleDbDataAdapter("Select * From Categories", conn)
da.Fill(ds, "Categories")

TextBox2.DataBindings.Add("Text", ds.Tables("Categories"),
"CategoryName")
DataGrid1.DataSource = ds.Tables("Categories")

Ken
-------------------------
"Graham Blandford" <gr**************@sympatico.ca> wrote in message
news:hK*********************@news20.bellglobal.com ...
Hi all,

I haven't received any replies to a previous question I posted regarding
problems I was having with databound textboxes.. so I'll try a different
angle...

Can anyone point me in the direction of.. or give me some good examples of
databinding of a dataset/table to textboxes in a windows form using CODE -
being assigned at runtime.

I can establish a connection, dataadaptor, dataset all at runtime, and if
I
can assign the datasource value of a datagrid, but I can't find any
examples
of databound textboxes - these use databindings, and all the items I've
found on these assume you are assigning the datasource at design-time in
the
IDE.

I have half the day trying to resolve this - moving from VB6 to .NET is
proving expensive and time-consuming.. any ideas would be greatly
appreciated...

Thanks,
Graham


Nov 20 '05 #2
Hi Ken,
Thanks, that's what I basically have - doesn't work. So here's the thing - I
have now created the connection etc. thru the IDE and assigned the bindings
through the IDE. If I now make changes to the bound data.. it stil doesn't
perform the update. If I check the HasChanges it is false! ????

I'm at a loss... any ideas?.. I can;t see that I am doing anything wrong..

Thanks,
Graham

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ut*************@TK2MSFTNGP10.phx.gbl...
Hi,

Dim strConn As String
Dim strSQL As String
Dim da As OleDbDataAdapter

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
strConn &= "Data Source = Northwind.mdb;"
conn = New OleDbConnection(strConn)
da = New OleDbDataAdapter("Select * From Categories", conn)
da.Fill(ds, "Categories")

TextBox2.DataBindings.Add("Text", ds.Tables("Categories"),
"CategoryName")
DataGrid1.DataSource = ds.Tables("Categories")

Ken
-------------------------
"Graham Blandford" <gr**************@sympatico.ca> wrote in message
news:hK*********************@news20.bellglobal.com ...
Hi all,

I haven't received any replies to a previous question I posted regarding
problems I was having with databound textboxes.. so I'll try a different
angle...

Can anyone point me in the direction of.. or give me some good examples of databinding of a dataset/table to textboxes in a windows form using CODE - being assigned at runtime.

I can establish a connection, dataadaptor, dataset all at runtime, and if I
can assign the datasource value of a datagrid, but I can't find any
examples
of databound textboxes - these use databindings, and all the items I've
found on these assume you are assigning the datasource at design-time in
the
IDE.

I have half the day trying to resolve this - moving from VB6 to .NET is
proving expensive and time-consuming.. any ideas would be greatly
appreciated...

Thanks,
Graham



Nov 20 '05 #3
Hi Graham,

Please keep the original thread, this is not a professional board however
individuals who try to help others. Some sleep do you know on times that you
are up.

Sometimes you get your answer in 5 minutes sometimes it can take 12 hours,
the most who helps in this newsgroup have a wide area, however no one knows
on every question an answer.

Your problem is however mostly this.
Set before the check for haschanges this

BindingContext(ds.Tables(0)).EndCurrentEdit()
or when you use more tables for that ds.tables(0) the right
dataset.tablename

I hope this helps?

Cor
Nov 20 '05 #5
Thank you Ben!

Exactly what I was looking for.

Graham

"Ben" <an*******@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
Check this article:
http://www.devcity.net/net/article.a...y1st_accessdb1

Nov 20 '05 #6
Hi Cor,

Thanks again - I apologize for my 'impatience' - just a little frustrated -
having spent the last couple of years finally building a VB6 framework to
make my database development VERY easy - I'm thrown into the .NET arena with
little time to show some results..... always the way right? ;-)

Anyway, I do appreciate all the help I get here and have the highest
admiration for those people that go out of their way to assist people like
me.

Thanks,
Graham


"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O4*************@TK2MSFTNGP10.phx.gbl...
Hi Graham,

Please keep the original thread, this is not a professional board however
individuals who try to help others. Some sleep do you know on times that you are up.

Sometimes you get your answer in 5 minutes sometimes it can take 12 hours,
the most who helps in this newsgroup have a wide area, however no one knows on every question an answer.

Your problem is however mostly this.
Set before the check for haschanges this

BindingContext(ds.Tables(0)).EndCurrentEdit()
or when you use more tables for that ds.tables(0) the right
dataset.tablename

I hope this helps?

Cor

Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: HAN(removethis)twister | last post by:
I've tried to create 11 textboxes as variables (not actually visible in the program, not in Windows Form Designer) and have set DataBindings to the text properties of the TextBoxes BUT according to...
2
by: C Glenn | last post by:
This is admitedly vague. But so is my understanding of the problem. I'm using this chunk of code: retControl.DataBindings.Add(ctrlBinding.PropertyName,DataSource,BindingField); This resolves...
0
by: XenReborn | last post by:
Ok this should be simple. I made a form, added a combobox (for selecting items to edit, not for updating fields), several textboxes, a few checkboxes etc. On formshow it connects to my database,...
7
by: =?Utf-8?B?Tmljb2xhcw==?= | last post by:
Yes another question about databindings. All my controls are have databindings and works fine for navigating, adding, deleting etc. What I want is when I create a New record have those fields...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.