Solved

How to select a control for a list of associated values?

Posted on 2006-06-14
4
170 Views
Last Modified: 2010-04-23
Hi,

I have to create a control on the form like:

list of valid courses
course          course date
1234               1/1/2006
12345             1/2/ 2006

and so on...i.e. the user can enter the course numbers and the associated dates, which will be used by my code in the program.

Which control should I use for this?

Thanks.
0
Comment
Question by:Reeds
  • 2
4 Comments
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 16905247
I would suggest a datagrid.  You can control data updates, inserts, and deletes via a data adapter.  It's a whole lot easier than creating a dynamic array of textboxes.
0
 

Author Comment

by:Reeds
ID: 16905291
But I don't take the data from the database for the control i.e. the user enters on the form the course numbers and dates. So, how can I use a data grid?
 
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 16905459
Add a DataGrid to your form...

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private DT As DataTable

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim DS As New DataSet
        DT = DS.Tables.Add("CourseInfo")
        DT.Columns.Add("Course", GetType(String))
        DT.Columns.Add("Course Date", GetType(DateTime))
        DataGrid1.DataSource = DT
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each DR As DataRow In DT.Rows
            Debug.WriteLine("Course: " & DR("Course") & ", Course Date: " & DR("Course Date"))
        Next
    End Sub

End Class
0
 

Author Comment

by:Reeds
ID: 16905860
Thanks much!!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

20 Experts available now in Live!

Get 1:1 Help Now