Solved

.NET - grid

Posted on 2002-06-06
3
312 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
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now