Solved

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

Posted on 2006-06-14
4
171 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Round up to 100% in .NET 10 87
Get String split 5 48
Changing the Source of an ADO Recordset while it's open 4 37
Help with Query not working in client's PC 1 35
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 …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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