Jump to content

dynamic grid

- - - - -

  • Please log in to reply
4 replies to this topic

#1
sp3tsnaz

sp3tsnaz

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
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 !!

#2
PunkDudez

PunkDudez

    Newbie

  • Members
  • PipPip
  • 10 posts
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 ?

#3
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
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();"

#4
sp3tsnaz

sp3tsnaz

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
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)Attached File  &#115;&#99;&#114;&#101;&#101;&#110;&#115;&#104;&#111;&#116;&#46;.PNG   8.08K   12 downloads

but i want to know how can i do that using code .. thats the only problem !!
Thankyou ,
Mohsin

#5
sp3tsnaz

sp3tsnaz

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
sorry :( i dont know about the object datasource




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users