hello all !!
i have a datagridview in my form , i want to assign it datasource and databinding source dynamically .. through code .. when i try to type Me.CustomerTableAdapter.Fill(etc etc )
the IDE says CustomerTableAdapter is not a part of Form1 ..
Please tell me how to do that through code ( making customerTableAdapter a part of form1 )
Note: i have a dataset1.xsd file ....
P.S : i had to shift my question from visual basic programming forum to here since no one had replied there .. Apologies admin !!
4 replies to this topic
#1
Posted 12 July 2010 - 11:47 PM
|
|
|
#2
Posted 13 July 2010 - 12:25 AM
Are you working on a WebApplication or Windows Forms (to run local) ?
A month ago when I was working on a ASP.NET project (=> WebApp).
I changed my datasource by "gridview.DatasourceID = ojectDataSource1;" for example.
But by reading your question i suggest you don't use objectDataSource objects ?
A month ago when I was working on a ASP.NET project (=> WebApp).
I changed my datasource by "gridview.DatasourceID = ojectDataSource1;" for example.
But by reading your question i suggest you don't use objectDataSource objects ?
#3
Posted 13 July 2010 - 01:20 AM
What PunkDudez said is correct. Without Datasources you can create a List<> of objects and do
"gridview.Datasource = list;"
And maybe you have to databind it after
"gridview.DataBind();"
"gridview.Datasource = list;"
And maybe you have to databind it after
"gridview.DataBind();"
#4
Posted 13 July 2010 - 11:13 PM
look what i did was that i added a dataset.xsd file , imported my database in that , then i dragged some gridviews in my form , all worked well because those particular gridviews were working for a single table .. but i have to insert another gridview which generates results according to the user's choice . which means that it has to use different tableadapters which have to be decided on runtime .. Now there was just one table that i had not used at all in my previous gridviews .. so the tableadapter for that particular table was not visible in my form ... now i just want to ask that how can i make that particular tableadapter usable in my form ... it is visible by intellisense but it is not a part of Form1 :( i have solved this thing by dragging a gridview control in my form and then clicking the small ">" button which appears in the top right corner of the gridview , then choosing the datasource as my table's binding source .. this thing automatically included a table adapter in my form's design ..( see the attached screen shot)
screenshot..PNG 8.08K
12 downloads
but i want to know how can i do that using code .. thats the only problem !!
Thankyou ,
Mohsin
screenshot..PNG 8.08K
12 downloadsbut i want to know how can i do that using code .. thats the only problem !!
Thankyou ,
Mohsin
#5
Posted 13 July 2010 - 11:15 PM
sorry :( i dont know about the object datasource
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









