Solved

.NET - grid

Posted on 2002-06-06
3
318 Views
Last Modified: 2010-05-02
In the Visual Studio .NET there is only one grid control, the DataGrid. Can this grid be used NOT binded to a database? (I mean, to add columns and rows, and write text in its cells?)

Or is there another grid control for .net available for free?

0
Comment
Question by:Azmodan
[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
3 Comments
 
LVL 28

Accepted Solution

by:
iboutchkine earned 50 total points
ID: 7061836
Yes you can use an unbound grid. here is an example


Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "
#End Region

    Private m_DataSet As DataSet
    Private m_dtFood As DataTable

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' Build the DataSet.
        m_DataSet = New DataSet()

        ' Build the States table.
        m_dtFood = New DataTable("Food")
        m_DataSet.Tables.Add(m_dtFood)

        Dim number_column As DataColumn
        number_column = New DataColumn("Number", GetType(Integer))
        number_column.AutoIncrement = True
        number_column.AutoIncrementSeed = 100
        number_column.AutoIncrementStep = 10
        m_dtFood.Columns.Add(number_column)

        m_dtFood.Columns.Add("Name", GetType(String))

        ' Populate the Food table.
        Dim food_data(1) As Object
        food_data(0) = Nothing
        food_data(1) = "Apple"
        m_dtFood.Rows.Add(food_data)

        food_data(1) = "Banana"
        m_dtFood.Rows.Add(food_data)

        food_data(1) = "Cherry"
        m_dtFood.Rows.Add(food_data)

        food_data(1) = "Date"
        m_dtFood.Rows.Add(food_data)

        food_data(1) = "Egg"
        m_dtFood.Rows.Add(food_data)

        food_data(1) = "Fig"
        m_dtFood.Rows.Add(food_data)

        ' Accept the data.
        m_DataSet.AcceptChanges()

        ' Attach the DataGrid to the DataTable.
        dgStates.DataSource = m_dtFood
    End Sub
End Class
0
 

Author Comment

by:Azmodan
ID: 7066640
This is a way of initialising the grid from a fake datasource, but is not used unbound.
So... i get that it can't be used unbound, and there isn;t another grid.. :(
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7858133
Hi Azmodan,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept iboutchkine's comment(s) as an answer.

Azmodan, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month6 days, 15 hours left to enroll

623 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