Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

Datagridview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
R.A.F. - 23 Oct 2007 18:22 GMT
Hi,

I have a really stupid question about DataGridView.
how dynamically create and display it on the form ?

i tried :

DataGridView myGrid = new DataGridView();
myGrid.Columns.Add("col1", "Column 1");
myGrid.Show();

but it does not work, so i miss something, but what ?
i've read the documentation but i did not find something :-(

thanks a lot,

RAF
R.A.F. - 23 Oct 2007 18:33 GMT
Ok...as i told...it's stupid question...
i forgot to add line :

Control.Add(myGrid);

:-)

> Hi,
>
[quoted text clipped - 13 lines]
>
> RAF
Nicholas Paldino [.NET/C# MVP] - 23 Oct 2007 18:38 GMT
RAF,

   You aren't binding any data to the grid, so it won't show anything.  You
have to bind a data source to the grid.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hi,
>
[quoted text clipped - 13 lines]
>
> RAF
R.A.F. - 23 Oct 2007 18:47 GMT
it's not necessary to bind any data... just to add a column is enough.

> RAF,
>
>     You aren't binding any data to the grid, so it won't show anything.  You
> have to bind a data source to the grid.
Nicholas Paldino [.NET/C# MVP] - 23 Oct 2007 19:20 GMT
Well, for the grid to be practical, it will be necessary to bind SOME
sort of data to it.  It wasn't clear from your original post whether you
were adding the grid to the controls or not, or if it was because you
weren't seeing any data.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> it's not necessary to bind any data... just to add a column is enough.
>
>> RAF,
>>
>>     You aren't binding any data to the grid, so it won't show anything.
>> You have to bind a data source to the grid.
R.A.F. - 23 Oct 2007 20:20 GMT
so sorry if it was not clear... for sure i will add data but not
necessary from database or table.
 :-)

>     Well, for the grid to be practical, it will be necessary to bind SOME
> sort of data to it.  It wasn't clear from your original post whether you
> were adding the grid to the controls or not, or if it was because you
> weren't seeing any data.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.