Solved

.NET - grid

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 …
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

838 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