Solved

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

690 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