pda and datagrid

Developing a simple pda app using a datagrid(MsFlexGrid would have been better but not supported by vb 2005 correct ). I need to populate the grid with a simple table the user selects a number from.

1. it appears i need to create a database to do that correct

2 will Excel work for the data base if so how please
and what format do i save it in

3. how do i import it

4. how do i get the numnber the user double clicked on

Thanks

Mitch



Answer this question

pda and datagrid

  • JYB

    Ok I've created a small file using Excel It consists of 5 columns and 40 rows... I save it as

    And then I import it how

    And then I load the datagrid how

    Sorry for these rudimentary questions but I've never used this before...

    Thanks

    Mitch


  • Michael Grau

    lets make this simpler on second thought ... the table will be static and never change so why don't we just initialize it in the form load statement everytime the user sstarts the pda app.

    How do I insert data in the data grid during program initializatio(form Load)

    there is 0only a few columns and rows and attaching a database would not be feasible ,,,,...!!!

    thanks

    Mitch


  • Choss_UK

    Here's a sample (and that's the best I can do). Further questions should be posted to generic VB forum as they are very basic and not NETCF specific.

    Public Class Form1

    Inherits System.Windows.Forms.Form

    Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid

    Friend WithEvents Button1 As System.Windows.Forms.Button

    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu

    Dim arrayListDataSource As ArrayList

    Public Class MyRow

    Dim _columnOne As String

    Dim _columnTwo As String

    Public Sub New(ByVal columnOne As String, ByVal columnTwo As String)

    Me._columnOne = columnOne

    Me._columnTwo = columnTwo

    End Sub

     

    Public Property ColumOne() As String

    Get

    Return Me._columnOne

    End Get

    Set(ByVal Value As String)

    Me._columnOne = Value

    End Set

    End Property

    Public Property ColumTwo() As String

    Get

    Return Me._columnTwo

    End Get

    Set(ByVal Value As String)

    Me._columnTwo = Value

    End Set

    End Property

     

    End Class

     

    #Region " Windows Form Designer generated code "

    Public Sub New()

    MyBase.New()

    'This call is required by the Windows Form Designer.

    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

    MyBase.Dispose(disposing)

    End Sub

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer.

    'Do not modify it using the code editor.

    Private Sub InitializeComponent()

    Me.MainMenu1 = New System.Windows.Forms.MainMenu

    Me.DataGrid1 = New System.Windows.Forms.DataGrid

    Me.Button1 = New System.Windows.Forms.Button

    '

    'DataGrid1

    '

    Me.DataGrid1.Size = New System.Drawing.Size(240, 200)

    Me.DataGrid1.Text = "DataGrid1"

    '

    'Button1

    '

    Me.Button1.Location = New System.Drawing.Point(128, 224)

    Me.Button1.Text = "Exit"

    '

    'Form1

    '

    Me.Controls.Add(Me.Button1)

    Me.Controls.Add(Me.DataGrid1)

    Me.Menu = Me.MainMenu1

    Me.Text = "Form1"

    End Sub

    #End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Me.arrayListDataSource = New ArrayList

    Me.arrayListDataSource.Add(New MyRow("Column 0.0", "Column 0.1"))

    Me.arrayListDataSource.Add(New MyRow("Column 1.0", "Column 1.1"))

    Me.DataGrid1.DataSource = Me.arrayListDataSource

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Me.Close()

    End Sub

    End Class



  • Jessica Alba

    Save it as CSV (comma separated values). Now open this file on device using classes from System.IO, read values and put them into any storage you like.

    You can use DataSet which allows you to create columns. Or create simple classes to hold your data with public properties for each field, e.g.:

    public class Customer {

    ...

    public string FirstName {

    get{...};

    set{...};

    }

    public string LastName {

    get{...};

    set{...};

    };

    ...

    }

    Now put these classes into ArrayList and grid would show these properties as columns. Each class instance would represent a row.



  • Sonnie-Cakes

    ArrayList myDataSource = new ArrayList();

    // Add your items here, load them from wherever they are stored.

    myDataSource.Add(...);

    dataGrid.DataSource = myDataSource;

    Now, you never mentioned where your data's coming from or how it's stored. May be it's in a text/XML file, may be it's random numbers generated on fly, may be you're getting it from network or may be it's SQL Mobile database - it does not matter, works the same way. For small amount of data you might want to use XML as data storage.

    As to MsFlexGrid, I'm reasonably confident it was never part of NETCF or desktop framework. DataGrid control was available from version 1.0, replaced with DataGridView on desktop framework 2.0. You're probably talking about long deprecated classic VB control, is that right



  • curiousss

    No, there's no DataGridView on NETCF.



  • Ryan F

    Please ask that in SQL Mobile forum.



  • ashish12345

    Create your custom record classes and initialize fields with '=' statement. Example:

    Custome c = new Customer();

    c.FirstName = "John";

    c.LastName = "Doe";

    arrayList.Add(c);

    // repeat as needed.

    You can also add constructor to set all these fields.



  • sfedorov

    Thank you

    1. I understand how to "Connect" the data source to datagrid but how do I create it

    what program must I use and what do I save it as

    MsFlexGrid is the old version of the new dataGrid!!!

    Mitch


  • Yann BOURON

    sorry new to vb 2005 I don't quite understand here is some data

    we will have 6 columns with the headers

    5 years, 10 years, 15 years, 20 years, 25 years, 30 years

    along the left side the top header should show "Rate"

    add 15 or so rows with numbers in them(doesnt make a diff what numbers)

    I will do this in form1 load function correct

    do I need to include anything in the project

    MItch


  • Sébastien Nunes

    1. No, that is incorrect. No database is needed to use DataGrid control, only data source is needed, it could be pretty much any collection, e.g. array. I don't know what “MsFlexGrid” is.

    2. No, it won't. There's no way to connect to Pocket Excel unless you write it all yourself.

    3. Import what to where

    4. Generally it’s done by subscribing to respective event and determining the location of the click. In case of DataGrid current cell is commonly used instead, there’s respective event for it.



  • JohnGr

    thanks for your best!!!

    Just found out that what I erally needed is datagridview as in a regular app.... PDA does not support that does it

    IOf it does how do I get it and use it Datagridview is simple to edit columns and rows but the only option I'm given for the pda is datagrid

    MItch


  • MHS

    I did not think so...

    I've created a small database to bind to my datagrid...*.sdf..

    No matter what i do it seems i can only add a header row to the database and I need to add 25 more rows How do I do that

    Mitch


  • pda and datagrid