Hello, I'm uneducated in programming and I'm starting off with Visual Basic since I can simply use the toolbox to add things. I have looked at variables and stuff.

I am using Visual Studio 2010 and am using the form part of Visual Basic in it. I used the calendar tool and so I have a calendar in the form and a rich text box underneath it.

Now here is what I'm wanting to do.

I want to assign the rich textbox to each date... so when I debug I would click on any date and say I have a doctors appointment and I type in Doctors appointment in the text box, I want it to link to that date and STAY.

So I should add a button that says save.. but how do I link all this together? I don't see any easy way in the toolbox unless I'm missing. Like I said this is my first time to be honest and I've done some Google research and haven't really found anything.

Hopefully you get what I'm saying. I'm sure this is already a program for people to buy or download.. but I'm wanting to get the hang of if and this seems like a pretty good way to start off...

How to link the textbox to each date and if i type something and click save it saves that text to that date.

Not as a text file neither it actually saves it into the program.

Thanks, if you don't understand what I mean simply reply back and I'll explain in as much detail as possible.

Thanks!

As you want to store the calendar entries permanent you should first decide how you wanna save the entries. if you wanna use a database, xml or just storing it in the my.settings.
I would suggest xml for you project as it is easy to learn (examle here)

here is a simple example on how to do this.
This sample is very straight and does not include any fancy stuff. thats something for you to tweak ...

Public Class Form1

	Private myDateList As List(Of MyDates)
	Private xmlFile As String = IO.Path.Combine(My.Application.Info.DirectoryPath, "dates.xml")

	Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		myDateList = New List(Of MyDates) 'create a new instance
		'check if the xml file exist, else create it
		Dim xdoc As XDocument
		If Not IO.File.Exists(xmlFile) Then
			xdoc = <?xml version="1.0" encoding="utf-8" standalone="yes"?>
				   <MyAppointments/>
			xdoc.Save(xmlFile)
		End If

		'then open the xml file
		XDoc = XDocument.Load(xmlFile)
		For Each xel As XElement In xdoc...<entry>
			myDateList.Add(New MyDates With {.MyDate = CDate(xel.@date), .MyNotes = xel.Value})	'adding the entry to our list
		Next
	End Sub

	Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
		'save class back to xml
		Dim xdoc As XDocument = XDocument.Load(xmlFile)
		xdoc...<entry>.Remove()	'clear all entries
		For Each mdate As MyDates In myDateList
			Dim xe As XElement = <entry date=<%= mdate.MyDate.ToShortDateString %>><%= mdate.MyNotes %></entry>
			xdoc.Root.Add(xe)
		Next
		xdoc.Save(xmlFile)
	End Sub


	Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
		RichTextBox1.Text = (From g As MyDates In myDateList Where g.MyDate = CDate(DateTimePicker1.Value.ToShortDateString) Select g.MyNotes).FirstOrDefault
	End Sub

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		If RichTextBox1.Text = "" Then
			MsgBox("Enter sone text")
			Return
		End If
		'add a check routine if the data already is in the class
		Try
			Dim var = (From g As MyDates In myDateList Where g.MyDate = CDate(DateTimePicker1.Value.ToShortDateString) Select g).First
		Catch ex As InvalidOperationException	'does not exist
			'add new entry to our list
			myDateList.Add(New MyDates With {.MyDate = CDate(DateTimePicker1.Value.ToShortDateString), .MyNotes = RichTextBox1.Text})
		End Try
	End Sub
End Class

Public Class MyDates
	Public Property MyDate As DateTime
	Public Property MyNotes As String
End Class

the resulting xml looks like:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<MyAppointments>
  <entry date="06.09.2010">walk with the dog</entry>
  <entry date="15.09.2010">fishing!!!</entry>
</MyAppointments>
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.