Solved

Grid without using database

Posted on 2011-09-13
6
349 Views
Last Modified: 2012-05-12
Hello, is it possible to have a grid on the screen (like a datagrid) without connecting the grid to a data control?

Thanks!

Paula
0
Comment
Question by:pvg1975
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 40
ID: 36532809
You probably have roots in VB6 :-) There is no DataControl in .NET. There is a BindingNavigator that plays a little of the same role, but is not exactly the same thing.

To answer your question: yes.

A datagrid can work with any array or collection in the .NET framework.

It can also be fed cell by cell. This is not hard to do if you want only to display invormation, but it can become more involved if the user need to edit the code and you need to keep the result changes).

What type of data do you want to put in the grid?
0
 

Author Comment

by:pvg1975
ID: 36532888
Hi James!

Yes, I did VB6 A LOT!!! and I just moved to .NET

I need to fill a grid with numbers and text only, that's all.
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 36532975
Once you will have crossed the wall that we all meet when moving from VB6 to VB.NET, you won't want to go back. It's a big step, but really worth it.

-----

What's the use of the grid?

Is this only to let the user select something and you will get the number to do something else afterward?

Does the user needs to see the number?

Your could have a ComboBox that displays the text and hides the number. You would then be able to retrieve the number for the selected text in only one line of code.

If so, tell me and I will show you how to do it with a ComboBox.

Otherwise we will go with the grid. For this one, you will need to have a version of Visual Studio that has the DataGridView control, not the DataGrid that was provided with the first versions of VS.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:pvg1975
ID: 36533058
Hi James! Yes its hard for me... to late to move, the company I work for had a huge application in VB6 and I got stucked on it... anyway, time to move :)

The grid is to enter numeric values coming from some textboxes.

I tried this:

MyGrid.Rows.Add(1)
MyGrid.Item(0, MyGrid.RowCount - 1).Value = N1.Text
MyGrid.Item(1, MyGrid.RowCount - 1).Value = N5.Text
MyGrid.Item(2, MyGrid.RowCount - 1).Value = N2.Text

with the intention of adding a row and possitioning the values on that last row, but what it does is to delete all previous entered rows and place the text on the last row.
0
 

Author Comment

by:pvg1975
ID: 36533063
Oh, Im using a datagridview not linked to any database.
0
 

Author Closing Comment

by:pvg1975
ID: 36533149
I made it work like this:

                Dim row = New String() {"4", "25", "4000"}
                MyGrid.Rows.Add(row)

Thanks!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question