I am trying to figure out how when a name typed in textbox1 on Form2 and a date is selected in the DateTimePicker box on Form2 that the name will show in textbox3 on Form1 when the date in MonthCalendar is pressed. I.E. Form2 opens and I enter the name David and below it I select the date March 10, 2014 and click ok. On Form1 I click March 10, 2014 on the MonthCalendar and in the textbox3 on Form1 will show David and every 10 business days his name will display on that date. So his name will show on March 10th and then again on March 24th and so on. Needing this to be able to add multiple names like in a list. Also....and this may not be able to happen....I have another form3 so can input days that need to be omitted. So if David's name shows on the 10th and I need the 12th omitted then instead of David showing on the 24th he will show on the 25th.

When program opens, it opens Form1

461ca3d1a3f3d9199c195cd670f556b5

When click on Edit> click on Schedule

de26c9a174e37d0747e31b8c1733d3ff

Opens Form2

f435b23e0f598654d2e0d868b38526de

Input Name and select color either Red or Yellow, select a Test Type, and Start Date. Depending on the color determines the days that needs till next recurrence. Red means every 10 days they need to be tested and yellow means every 20 days. Then click ok

c810380ef4dc98f517face11dfa55de6

Form2 closes and on Form1, depending on the color chosen it puts the name with the test beside it in the corresponding column.

2b78c6937f9609157cb01d6d1a1a62a7

When clicking on the date that was selected as the start date it should populate into textbox3 labeled Today’s Schedule.

2611a424fe2889ac5d31a61109e1a309

This all works fine but when I click on dates after the start date (IE 3/5, 3/6, etc) it keeps listing the names which is not what I am needing. I am needing for the names in the red column to show up once every 10 days and yellow every 20 days and to only show up on the date that is clicked.

5e97f63d70fa20a833bd579383e424c6

Here is the full code for Form1:

Public Class Form1
    Dim FP As String
    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()

    End Sub

    Private Sub StudentScheduleToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StudentScheduleToolStripMenuItem.Click

        If Form2.ShowDialog = Windows.Forms.DialogResult.OK Then
            If Form2.ComboBox2.SelectedItem = "Select Test Type" Then
                MessageBox.Show("Please select a test type!")
            ElseIf Form2.ComboBox2.SelectedItem = "FSF" Then
                Form2.TextBox1.Text += " (FSF)"
            ElseIf Form2.ComboBox2.SelectedItem = "LNF" Then
                Form2.TextBox1.Text += " (LNF)"
            ElseIf Form2.ComboBox2.SelectedItem = "PSF" Then
                Form2.TextBox1.Text += " (PSF)"
            ElseIf Form2.ComboBox2.SelectedItem = "NWF" Then
                Form2.TextBox1.Text += " (NWF)"
            ElseIf Form2.ComboBox2.SelectedItem = "DORF" Then
                Form2.TextBox1.Text += " (DORF)"
            ElseIf Form2.ComboBox2.SelectedItem = "DAZE" Then
                Form2.TextBox1.Text += " (DAZE)"
            ElseIf Form2.ComboBox2.SelectedItem = "WR" Then
                Form2.TextBox1.Text += " (WR)"
            ElseIf Form2.ComboBox2.SelectedItem = "TRC" Then
                Form2.TextBox1.Text += " (TRC)"

            End If

            Select Case Form2.ComboBox1.SelectedItem.ToString.ToLower
                Case "red"
                    TextBox1.AppendText(Form2.TextBox1.Text & Environment.NewLine)

                Case "yellow"
                    TextBox2.AppendText(Form2.TextBox1.Text & Environment.NewLine)
                Case Else
                    MessageBox.Show("Please select a color!")
            End Select
        End If
    End Sub

    Private Sub DaysToOmitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DaysToOmitToolStripMenuItem.Click
        Dim daysomit As New Form3
        daysomit.Show()
    End Sub

    Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
        Dim About As New AboutBox2
        About.Show()
    End Sub

    Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click

        My.Computer.FileSystem.WriteAllText("Log.spms", TextBox1.Text, False)

    End Sub

    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
        Dim Open As New OpenFileDialog()

        Open.Filter = "Student Progress Monitoring Schedule (*.spms)|*.spms|All Files(*.*)|*.*"
        Open.Title = "Open"
        Try
            If Open.ShowDialog() = Windows.Forms.DialogResult.OK Then
                TextBox1.Text = My.Computer.FileSystem.ReadAllText("Log.spms")
                Me.Text = "Text Editor" + Open.FileName
                FP = Open.FileName
            End If
        Catch ex As Exception

        End Try

    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        If Form2.Status = Windows.Forms.DialogResult.OK Then
            Dim name As String = Form2.TextBox1.Text.Trim()
            Dim dateEntered As Date = Form2.DateTimePicker1.Value.Date
        End If

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = My.Computer.FileSystem.ReadAllText("Log.spms")

    End Sub

    Private Sub MonthCalendar1_DateSelected(ByVal sender As Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected
        TextBox3.AppendText(TextBox1.Text & TextBox2.Text & Environment.NewLine)

    End Sub

    Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
        TextBox1.Text = My.Computer.FileSystem.ReadAllText("New.spms")
    End Sub
End Class

And here is the full code for Form2:

    Public Class Form2
        Inherits Form
        Friend WithEvents tbName As New System.Windows.Forms.TextBox
        Friend WithEvents dtpKeyDate As New System.Windows.Forms.DateTimePicker
        Friend WithEvents btnOk As New System.Windows.Forms.Button
        Friend WithEvents btnCancel As New System.Windows.Forms.Button
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Me.DialogResult = Windows.Forms.DialogResult.Cancel

        End Sub

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If TextBox1.TextLength > 0 AndAlso ComboBox1.SelectedIndex <> -1 Then
                Me.DialogResult = Windows.Forms.DialogResult.OK
            End If

        End Sub

        Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged

        End Sub

        Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

        End Sub

        Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            TextBox1.Clear()
            ComboBox1.SelectedIndex = 0
            ComboBox2.SelectedIndex = 0
            DateTimePicker1.Value = Now

        End Sub

        Friend Status As System.Windows.Forms.DialogResult = Windows.Forms.DialogResult.Cancel

    End Class

Again everything is working fine except the 10 and 20 day recurrence and names are not clearing on each date clicked.

I am not a programmer and still learning new things. I am trying to make this to help my wife. Any assistance is greatly appreciated!

Check line 91 on "Form1". You do the following: TextBox3.AppendText(TextBox1.Text & TextBox2.Text & Environment.NewLine) every time a date is selected.

Private Sub MonthCalendar1_DateSelected(ByVal sender As Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected
     TextBox3.AppendText(TextBox1.Text & TextBox2.Text & Environment.NewLine)
End Sub

"Append" means to add to the end of that which already exists.

Use TextBox3.Text = instead. But you will probably have to see if the name already exists, to determine if you need to add it. Have you considered a ListBox?

Everything you mentioned is possible. You might consider using an XML file or a database to store your data.

Here is a post I made about how to read an XML file--see my last post.

Your XML file might look like this:

Students.xml

<?xml version="1.0"?>

<students>
    <student id="1">
        <name>John</name>
        <firstTestDateFSF>02/10/2014</firstTestDate>
        <lastTestDateFSF>03/10/2014</lastTestDate>
        <firstTestDateLNF>02/15/2014</firstTestDateLNF>
        <lastTestDateLNF>03/15/2014</lastTestDateLNF>
    </student>

    <student id="2">
        <name>Susie</name>
        <firstTestDateFSF>02/12/2014</firstTestDate>
        <lastTestDateFSF>03/12/2014</lastTestDate>
        <firstTestDateLNF>02/18/2014</firstTestDateLNF>
        <lastTestDateLNF>03/18/2014</lastTestDateLNF>
    </student>
</students>

OmittedDates.xml

<?xml version="1.0"?>

<omittedDates>
    <omittedDate id="1">
        <name>Independence Day</name>
        <dayOfYear>07/04/2014</dayOfYear>
    </omittedDate>

    <omittedDate id="2">
        <name>Thanksgiving</name>
        <dayOfYear>11/27/2014</dayOfYear>
    </omittedDate>
</omittedDates>

I made some errors when posting "Students.xml" above. The tags should follow the format: <name> </name>

Students.xml

<?xml version="1.0"?>

<students>
    <schoolyear startMonth="08" startYear="2013" endMonth="05" endYear="2014">
        <student id="1">
            <name>John</name>
        <firstTestDateFSF>02/10/2014</firstTestDateFSF>
            <lastTestDateFSF>03/10/2014</lastTestDateFSF>
        <firstTestDateLNF>02/15/2014</firstTestDateLNF>
            <lastTestDateLNF>03/15/2014</lastTestDateLNF>
        </student>

        <student id="2">
            <name>Susie</name>
        <firstTestDateFSF>02/12/2014</firstTestDateFSF>
            <lastTestDateFSF>03/12/2014</lastTestDateFSF>
        <firstTestDateLNF>02/18/2014</firstTestDateLNF>
            <lastTestDateLNF>03/18/2014</lastTestDateLNF>
        </student>
    </schoolyear>
</students>

Thank you so much for your assistance on this. I was trying to figure out a way that she won't have to edit things like a spreadsheet and then have to run the program. Is there another way of doing this without the xml file or is that my only option?

You can store your data however you like--in a plain text file if you want. A database or XML file would help to keep your data organized. How long does the data need to be kept for each student? How many students? You said you're not a "programmer", what is your programming experience and what is your goal? Are you trying to learn to program or just write this one program?

The number of students changes every year of nourse but usually 20+ students. I have made a couple programs (like 2). Nothing big or too in depth. I am trying to learn and learn by doing things, but I am not looking to do this everyday just trying to write this one program for now and the knowledge is helpful if I ever need to make something else.

Since you have limited experience, it may be easiest to do the following:

  • Create a folder for the schoolyear (ex: 2013)
  • Then within the folder, create either one text file, or one text file for each student.

If you aren't interested in writing the program, but want the end-result, you could hire someone to do it for you. There are websites like this one.

If I was to do a text file, which I think I know what I can do, once it is created how is it used within the code. I would like to work on this myself bc coding has always interested me and am wanting to go back to school to learn more on it.

I made the OmittedDays xml file but not sure where it needs to be implemented, whether it is un Form3 with the submit button or in the calendar on Form1. Also was looking at your other post and a little confused how to modify this for just selecting the Holidays in the xml file compared to the code that was written in the other post.

Your main (parent) form needs to be aware of any changes made to any of the files. I recommend passing everything to the main (parent) form and letting the main form write the information to the files that way the main form always has the most up-to-date information.

You could probably use the FileSystemWatcher class
. Although, I wouldn't use it in this case.

I think that you should probably use either a book or some tutorials to work on the basics before you try to work on something more advanced.

There are many online tutorials--both written and video. Here is one that I found:

VB Fundamentals for Absolute Beginners

After you complete lessons 6-21, you should be equipped to do your project. I think that realistically, you could have your project completed by mid-July to mid-August.

Awesome, thank you for all your help!

Since you are learning a new programming language, you may consider learning C# instead. I'm not certain, but I think that it may be more widely used. You could accomplish your project with either one, however.

C# Fundamentals For Absolute Beginners

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.