?
Solved

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

Posted on 2006-06-14
4
Medium Priority
?
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 86

Accepted Solution

by:
Mike Tomlinson earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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 …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 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