Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-06-14
4
Medium Priority
?
177 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

618 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