It is probably a case-sensitive issue as ddanbe said. Try changing:
protected override void onload(EventArgs e)
To:
protected override void OnLoad(EventArgs e)
The "O" and the "L" should be capitalized.
It is probably a case-sensitive issue as ddanbe said. Try changing:
protected override void onload(EventArgs e)
To:
protected override void OnLoad(EventArgs e)
The "O" and the "L" should be capitalized.
Here is a version that passes data from the child form (CashBookUpdation) to the main form (CashBook). We will use the same classes as above, but will add to it. Also, I renamed "SendNotification" to "SendUpdates" in CashBookUpdation.
Additionally, for demonstration purposes I added two textboxes to CashBookUpdation.vb.
I added Property "Name" and "Amount" to ValueUpdatedEventArgs.vb as well as a constructor that can be used to set the values for them.
ValueUpdatedEventArgs.vb
Imports System
Public Class ValueUpdatedEventArgs
Inherits System.EventArgs
'forwards calls to appropriate event handler
Public Delegate Sub ValueUpdatedEventHandler(ByVal sender As Object, ByVal e As ValueUpdatedEventArgs)
Private _name As String
Private _amount As Double
'constructor
Public Sub New()
End Sub
'constructor
Public Sub New(ByVal Name As String, _
ByVal Amount As Double)
_name = Name
_amount = Amount
End Sub
Public Property Name As String
Get
Return _name
End Get
Set(value As String)
_name = value
End Set
End Property 'Name
Public Property Amount As Double
Get
Return _amount
End Get
Set(value As Double)
_amount = value
End Set
End Property 'Amount
End Class
CashBookUpdation is mostly the same. The main difference is that instead of using this constructor:
valueArgs = New ValueUpdatedEventArgs()
I am using this one:
valueArgs = New ValueUpdatedEventArgs(name, amount)
CashBookUpdation.vb
Public Class CashBookUpdation
'Event interested parties can register with to know
'when value is updated.
'ValueUpdatedEventHandler is delegate defined in ValueUpdatedEventArgs
Public Event ValueUpdated As ValueUpdatedEventArgs.ValueUpdatedEventHandler
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim name As …
Use an event and a delegate to notify the main form (CashBook) that an update has occured.
Create a new class and name it: ValueUpdatedEventArgs.vb
ValueUpdatedEventArgs.vb
Imports System
Public Class ValueUpdatedEventArgs
Inherits System.EventArgs
'forwards calls to appropriate event handler
Public Delegate Sub ValueUpdatedEventHandler(ByVal sender As Object, ByVal e As ValueUpdatedEventArgs)
'constructor
Public Sub New()
End Sub
End Class
In the child form (CashBookUpdation) we want to raise an event which the main form (CashBook) is listening for.
CashBookUpdation.vb
Public Class CashBookUpdation
'Event interested parties can register with to know
'when value is updated.
'ValueUpdatedEventHandler is delegate defined in ValueUpdatedEventArgs
Public Event ValueUpdated As ValueUpdatedEventArgs.ValueUpdatedEventHandler
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
SendNotification()
End Sub
Private Sub SendNotification()
'create a new instance of ValueUpdatedEventArgs
Dim valueArgs As ValueUpdatedEventArgs
valueArgs = New ValueUpdatedEventArgs()
'raise event "ValueUpdated"
'Me refers to this class
'valueArgs is a new instance of "ValueUpdatedEventArgs"
'and contains our schedule information
'we want to pass to the main form (CashBook)
RaiseEvent ValueUpdated(Me, valueArgs)
End Sub
End Class
In our main form (CashBook), we need to add a handler (or listener) that performs an action whenever the event is raised in CashBookUpdation.
I know that you are using a DataGridView, but I used a button on the main form for demonstration purposes. Place the code that is inside "Button1_Click" below, in the event handler for your DataGridView (DataGridView1_CellDoubleClick or whatever one you are using).
CashBook.vb
Private Sub Button1_Click(sender As System.Object, e As …
You haven't provided any code so it's difficult to know how you are transferring information between the forms or if you are transfering information between the forms.
Also what controls are on CashBookUpdation? What is supposed to cause the update to happen? Click on a button?
A screen capture would be beneficial.
What is your data source?
Place numbers 1-16 in an ArrayList:
//holds numbers 1-16
ArrayList uniqueNums = new ArrayList();
//add numbers 1-16
for (int i=0; i < 16; i++)
{
uniqueNums.add(i+1);
}//for
Use the following random number generator method. It was taken from here.
randInt:
public static int randInt(int min, int max) {
// Usually this can be a field rather than a method variable
Random rand = new Random();
// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive
int randomNum = rand.nextInt((max - min) + 1) + min;
return randomNum;
}
"randInt" is used below.
Generate unique random numbers like this:
//choose random int
for (int j = 15; j >= 0; j--)
{
int selectedNum = randInt(0,j);
//i print out the selected number.
//you will add it to your matrix here
System.out.println("selected: " + uniqueNums.get(selectedNum));
//after a number is added to the
//matrix, remove it from
//the arraylist
uniqueNums.remove(selectedNum);
System.out.println();
}//for
You can add your numbers to the matrix where I have the "System.out.println...." statement.
You probably want to do some input validation to ensure that the user entered an integer value when an integer value is required. See "isInt" below for a way of performing integer validation.
Declare the following variables as global (before "Main"):
//need to declare as static
//if used inside static methods
//passenger array
private static string[] passengers;
//number of tickets sold
private static int ticketsSold = 0;
//number of seats remaining
private static int seatsRemaining = 0;
Main:
//for prompting to exit
string answer = string.Empty;
//clear the screen
Console.Clear();
//write empty line
Console.WriteLine();
//total airplane seats
//string variable is for console input
//int variable is for use in our program
int totalNumberOfSeatsInt = 0;
string totalNumberOfSeatsStr = string.Empty;
//total airplane seats user is trying to purchase
//string variable is for console input
//int variable is for use in our program
int ticketsToPurchaseInt = 0;
string ticketsToPurchaseStr = string.Empty;
Boolean isValidInput = false;
//--------------------------
//get number of seats
//--------------------------
//loop until we receive an int
//if number of seats available = 0, exit
do
{
//prompt user
Console.Write("How many seats are on the airplane? ");
//get number of seats being purchased
totalNumberOfSeatsStr = Console.ReadLine();
//check to see if input was an integer
isValidInput = isInt(totalNumberOfSeatsStr);
//if input is an integer, convert to int
if (isValidInput == true)
{
totalNumberOfSeatsInt = Convert.ToInt32(totalNumberOfSeatsStr);
//if no seats are available, exit
if (totalNumberOfSeatsInt <= 0)
{
Console.WriteLine("Exiting. Thank you.");
Console.WriteLine();
return; //exit
}//if
}//if
else
{
//write empty line …
To start:
progressBar1.Style = ProgressBarStyle.Marquee;
progressBar1.MarqueeAnimationSpeed = 30;
progressBar1.Visible = true;
To stop:
progressBar1.Visible = false;
Additionally, to stop it, you could add:
progressBar1.Style = ProgressBarStyle.Continuous;
progressBar1.MarqueeAnimationSpeed = 0;
Although, it is probably unnecessary.
Did you try refreshing the form after the buttons are generated?
this.Refresh();
In line 19, use "String.Compare" instead of "<>". This seems unnecessary however, because you already passed all of the information in your SQL query and if it returns any rows, then the information is correct. You could just do a Select Count(*) FROM ....
, if the result == 1 then the login information is correct. If the result== 0 then the login information was incorrect.
The code for Client.vb is above, in my very first post.
TextBox1.Focus will not work, since whenever one presses a virtual key (button) focus will now be on the button, not on the previously selected TextBox.
You haven't given any information about your code. I am going to make the following assumptions:
There are a few different events that you could probably use, although I don't have a touch-screen to test them:
There may be more.
In my solution, we will use a variable to keep track of which TextBox is selected, since whenever we press a button (virtual key) focus will be on that control.
'do not define as "New"
'we will initialize it in form_load
Dim desiredTextBox As TextBox
In "Load" event of the form, place the following:
If desiredTextBox Is Nothing Then
'initialize desiredTextBox
'set to TextBox1
desiredTextBox = TextBox1
End If
So our code is something like this:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
If desiredTextBox Is Nothing Then
'initialize desiredTextBox
'set to TextBox1
desiredTextBox = TextBox1
End If
End Sub
I am going to use the "Enter" event for each TextBox to set the value of "desiredTextBox". This is the way we will keep track based on the last TextBox the user selected.
Private Sub TextBox2_Enter(sender As System.Object, e As System.EventArgs) Handles TextBox2.Enter
Console.WriteLine("Textbox2 enter")
'set desiredTextBox = TextBox2
desiredTextBox = sender
End Sub
Private Sub TextBox1_Enter(sender As System.Object, e As System.EventArgs) Handles TextBox1.Enter
Console.WriteLine("Textbox1 enter")
'set desiredTextBox = TextBox1
desiredTextBox = sender
End Sub
Now write to …
Access is just a file, and uses a file lock. It is single-user. What issues are you having? Copy the file to your local computer, and see if you encounter the same issues you are having.
What is your connection string? Are you using a mapped drive?
ODBC Connection for remote MS Access database must use UNC path. Click here for more info.
Use a DataGridView
That error occurs if you have non-numeric data in the variable that you are trying to convert. Check to see what "BlockNo1" contains.
Ensure ListView.View = View.Details
'set to details view
ListView1.View = View.Details
Did you already create the columns? If not, add this to your code:
'Add columns to listview
ListView1.Columns.Add("SKU")
ListView1.Columns.Add("Quantity")
ListView1.Columns.Add("Description")
ListView1.Columns.Add("UOM")
ListView1.Columns.Add("SRP")
ListView1.Columns.Add("Origin")
ListView1.Columns.Add("Department")
To add the data to ListView1:
'increment through each record in recordset
'and add data to ListView1
For i As Integer = 0 To rst.RecordCount - 1
Dim item As ListViewItem
'add new row and add value of "SKU" to first column
item = New ListViewItem(rst.Fields.Item("SKU").Value.ToString(), 0)
'add value to 2nd column
item.SubItems.Add(rst.Fields.Item("Quantity").Value.ToString())
'add value to 3rd column
item.SubItems.Add(rst.Fields.Item("Description").Value.ToString())
'add value to 4th column
item.SubItems.Add(rst.Fields.Item("SRP").Value.ToString())
'add item to ListView1
ListView1.Items.Add(item)
'move to next record
rst.MoveNext()
Next
One more note, my code above assumes that you have 3 radio buttons on your form and the radio buttons work as a group (are on a "Panel" or "Groupbox"). Finally, that the radio buttons are named: radDef1, radDef2, radDef3.
Additionally, my previous post assumes that you have a button on your form named: ButtonNext
If you want to use with a "Next" button then add the following:
Private selectedRadioButton As RadioButton
Declarations after adding:
Private kv As Dictionary(Of String, String) 'Define kv as a dictionary
Private keyword As String
Private correctDefinition As String
Const NUMBER_OF_ANSWERS As Integer = 3 'Define the constant NUMBER_OF_ANSWERS
'Added - keeps track of which button
'is selected
Private selectedRadioButton As RadioButton
Then, add the following to "radDefx_CheckedChanged":
selectedRadioButton = rad
radDefx_CheckedChanged
Private Sub radDefx_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radDef1.CheckedChanged, radDef2.CheckedChanged, radDef3.CheckedChanged
Dim rad As RadioButton = sender
'Because this event triggers when a radiobutton is
'deselected as well as selected, we only want to process
'the SELECTED event. Also, one radio button will be
'selected automatically. If you start with the label
'(which displays the word) being blank then you can
'ignore the initial SELECTED even on form load.
If rad.Checked And LabelKeyWord.Text <> "" Then
'set so we can use with next button
selectedRadioButton = rad
If rad.Text <> String.Empty Then 'Not sure what to put here Then
Console.WriteLine("in rad")
'check to see if answer is correct
'Not used when button is used
'checkAnswer(LabelKeyWord, rad)
End If
End If
End Sub
Private Sub ButtonNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonNext.Click
checkAnswer(LabelKeyWord, selectedRadioButton)
End Sub
Note: Use with "checkAnswer" in my previous post.
After you change lines 21-23 and 57-58
From:
RadioButtonDef1.Text = definitionsRandom(0)
RadioButtonDef2.Text = definitionsRandom(1)
RadioButtonDef3.Text = definitionsRandom(2)
To:
radDef1.Text = definitionsRandom(0)
radDef2.Text = definitionsRandom(1)
radDef3.Text = definitionsRandom(2)
Note: I renamed "radDef1_CheckedChanged" to "radDefx_CheckedChanged"
I added the following sub: checkAnswer
Private Sub checkAnswer(ByRef myLabel As Label, _
ByRef selectedRadioButton As RadioButton)
If Not selectedRadioButton Is Nothing Then
If kv.ContainsKey(myLabel.Text) Then
Console.WriteLine("contains labelkeyword.text. Value: '" & _
kv.Item(myLabel.Text) & "'")
Console.WriteLine("selectedRadioButton.text = '" & _
selectedRadioButton.Text & "'")
If String.Equals(kv.Item(myLabel.Text), _
selectedRadioButton.Text) Then
MessageBox.Show("You are correct.")
Else
'the answer is incorrect
MessageBox.Show("NOT correct.")
End If
End If
End If
End Sub
Then call it in "radDefx_CheckedChanged":
Private Sub radDefx_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radDef1.CheckedChanged, radDef2.CheckedChanged, radDef3.CheckedChanged
Dim rad As RadioButton = sender
'Because this event triggers when a radiobutton is
'deselected as well as selected, we only want to process
'the SELECTED event. Also, one radio button will be
'selected automatically. If you start with the label
'(which displays the word) being blank then you can
'ignore the initial SELECTED even on form load.
If rad.Checked And LabelKeyWord.Text <> "" Then
If rad.Text <> String.Empty Then 'Not sure what to put here Then
Console.WriteLine("in rad")
'check to see if answer is correct
checkAnswer(LabelKeyWord, rad)
End If
End If
End Sub
In your latest code you seem to be referencing radio buttons:
radDef1 AND RadioButtonDef1.
radDef2 AND RadioButtonDef2.
radDef3 AND RadioButtonDef3.
Do you have 6 buttons or did you forget to change this after a rename of the radio buttons?
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.
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.
Try something like the following:
try
{
string SQLUpdateString = string.Empty;
SQLUpdateString = "update Personaldata set BlockNo = @blockNo, ";
SQLUpdateString += "LotNo = @lotNo, ";
SQLUpdateString += "Numberofoccupants = @numOccupants, ";
SQLUpdateString += "FamilyName = @familyName, ";
SQLUpdateString += "Dateofbirth = @dateofbirth, Age = @age, ";
SQLUpdateString += "Placeofbirth = @placeofbirth, ";
SQLUpdateString += "Religion = @religion ";
SQLUpdateString += "where BlockNo = @blockNo";
OleDbCommand SQLCommand = new OleDbCommand();
SQLCommand.CommandText = SQLUpdateString;
SQLCommand.Parameters.Add("@blockNo", BlockNo);
SQLCommand.Parameters.Add("@lotNo", LotNo);
// ...
}//try
catch (OleDbException ex)
{
MessageBox.Show("Error: " + ex.Message);
}//catch
It will make your code easier to follow and help prevent SQL injection.
What are you trying to accomplish? Why are you replacing a single quote with two single quotes?
Check your where clause. What is the data type of BlockNo? You have
`+ "' WHERE BlockNo=" + BlockNo + "";
If BlockNo is a string you need to surround it with single quotes.
+ "' WHERE BlockNo= '" + BlockNo + "'";
Also, you should use parameterized queries to avoid SQL injection.
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.
Check to see if this is causing the error: SET BlockNo ='" + BlockNo.Replace("'", "''") + "'
. What data does "BlockNo" contain? And how are you wanting it to be stored in the database?
Using WMI, try looking in
What type of device is it? Is it a bluetooth device? Did you try searching the registry for COM9?
search for: COM9
Is Access 2013 installed on the development computer or did you copy the file from a computer that has Access 2013 installed? Did you add a reference to the Access object library?
Project => Add Reference => COM => Microsoft Access xx.x Object Library
Requesting the data twice will increase the load on the server. To say that it will make your application half as responsive is an overstatement--the server querying the database is only part of the process (the part which you can't get the progress of). Performing a database query is like any other thing in life, there are costs and benefits. One must ask, if the cost is worth the benefit. You must also take into account the cost to the database, the end-user, and the other users. Providing reassurance to an end-user always increases the cost of performing the operation.
You could probably use a ProgressBar with Style = Continuous (if using a BackgroundWorker). It doesn't show any actual progress, but is more of an animated graphic that provides reassurance to the end-user.
You only seem to be retrieving no rows or 1 row, so it seems unnecessary. You could use a status label, instead to keep the user informed what is going on.
In order to use a progress bar above, you will need to first get the number of rows:
Select Count(*) from Borrower where user_name='" & EmsTextBox1.Text & "' AND userpass = '" & EmsTextBox2.Text & "'"
This query most likely only returns 0 or 1 rows.
Then run the query (above) to retrieve your data.
This would be more useful if you are retrieving many rows such as:
Select * from Borrower
So, you would first get the row count using:
Select Count(*) from Borrower
Then, get your data:
Select * from Borrower
Use a counter in your loop to keep track of the current row number. You know the total number of rows from the first query.
You would probably have to use a BackgroundWorker to accomplish this.
How to: Use a Background Worker
101 Samples for Visual Basic 2005
(In "Base Class Libraries - Group 2 Samples", see "WorkingWithThreads")
I added another Try-Catch in this version:
Private Sub readDB(ByVal username As String, ByVal userpassword As String)
Using con As New SqlConnection
con.ConnectionString = connString
Try
con.Open()
Using cmd As New SqlCommand
Dim rd As SqlDataReader
Dim dbUsername As String
Dim dbUserpassword As String
Try
cmd.Connection = con
cmd.CommandText = "Select User_Name, userpass from Borrower where username= @username AND password = @userpassword"
cmd.Parameters.AddWithValue("@username", username)
cmd.Parameters.AddWithValue("@userpassword", userpassword)
rd = cmd.ExecuteReader
If rd.HasRows Then
'read row-by-row
Do While rd.Read
'get row data for username
dbUsername = rd("username").ToString()
'get row data for userpassword
dbUserpassword = rd("userpassword").ToString()
Loop
MsgBox("SUCCESS")
Else
MsgBox("wrong")
End If
'close the reader
rd.Close()
Catch ex As SqlException
Console.WriteLine(ex.Message)
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ex As Exception
Console.WriteLine(ex.Message)
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Using 'SqlCommand
Catch ex As SqlException
Console.WriteLine(ex.Message)
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ex As Exception
Console.WriteLine(ex.Message)
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Using 'SqlConnection
End Sub
Adding "New" should fix your issue:
From:
Dim con As SqlConnection
Dim cmd As SqlCommand
To:
Dim con As New SqlConnection
Dim cmd As New SqlCommand
You should consider using a Using statement:
The scope of your variables should only be as big as
necessary. Also, use parameterized queries to avoid SQL injection.
I would consider changing your code as follows:
Imports System
Imports System.Data.SqlClient
Public Class Login
Dim connString As String = "Server=IGNITER-PC\OBEXPRESS;Database=EMS;User ID=sa;Password=au"
Private Sub readDB(ByVal username As String, ByVal userpassword As String)
Using con As New SqlConnection
con.ConnectionString = connString
con.Open()
Using cmd As New SqlCommand
Dim rd As SqlDataReader
Dim dbUsername As String
Dim dbUserpassword As String
Try
cmd.Connection = con
cmd.CommandText = "Select User_Name, userpass from Borrower where username= @username AND password = @userpassword"
cmd.Parameters.AddWithValue("@username", username)
cmd.Parameters.AddWithValue("@userpassword", userpassword)
rd = cmd.ExecuteReader
If rd.HasRows Then
'read row-by-row
Do While rd.Read
'get row data for username
dbUsername = rd("username").ToString()
'get row data for userpassword
dbUserpassword = rd("userpassword").ToString()
Loop
MsgBox("SUCCESS")
Else
MsgBox("wrong")
End If
'close the reader
rd.Close()
Catch ex As SqlException
Console.WriteLine(ex.Message)
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ex As Exception
Console.WriteLine(ex.Message)
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Using 'SqlCommand
End Using 'SqlConnection
End Sub
Private Sub EmsStickyButton1_Click(sender As Object, e As EventArgs) Handles EmsStickyButton1.Click
readDB(EmsTextBox1.Text, EmsTextBox2.Text)
End Sub
End Class
Probably a database lock issue. Make sure you are closing your connection after using it. Better yet, use a "using" statement.
Also, make sure you don't have the file open in Access. Access is not a DBMS, it is a database file and doesn't support multiple connections--it is single-user. When the database is in use, you will see a ".laccdb" file in the directory. 'l' stands for lock.
using (OleDbConnection CONN = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\Vendors.accdb;"))
{
....
}
You need to convert "splittedText2[i]" and "splittedText3[i]". What database are you using? Here are some mappings:
Since you have limited experience, it may be easiest to do the following:
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.
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?
Here is a post that fills a combobox from a database. This may work for you.
Where are you clearing the items? It should be
OleDbDataReader CMBRdr = DBcmd.ExecuteReader();
//add it here
PhoneCombo.Items.Clear();
while (CMBRdr.Read())
{
I'm confused by your explanation. Can you post the code or post some screen captures?
Try clearing the PhoneCombo combobox before adding the items.PhoneCombo.Items.Clear()
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>
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>
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?