Here is a tricky one for ya...

laroberts

Freshman
Joined
Jun 29, 2005
Messages
34
Ok I have a form... on the form is two combo drop down boxes. Also there is one text box.

In the first combo box which is named: ComboBox22
The item listed in this box are the following:
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday


In the second Combo box which is named: Combobox23
The items listed in this box are the following:
First Shift
Second Shift
Third Shift

The text box on the form is named: TextBox1

Also there is a RichTextBox on the form for the person to fill out.

Then there is a save button.

I currently have the save button code looking like this:

Dim dayofweek as String = CStr(Me.ComboBox22.SelectedItem)
Dim ShiftAssigned as String = CStr(Me.ComboBox23.SelectedItem)
RichTextBox1.SaveFile(String.Format("E:\", "Dayofweek", "\", "ShiftAssigned", "\", "({Textbox1}.rtf"))


Now I am very new to VB and I am not doing something right with the above code cause when I push the save button it says:

Access to the path "E:\" is denied"

Not possible as its my own drive but I know its my coding. Can somebody please show me the correct code for this.

Basicly the user needs to select a day of week from the first drop down, then select the shift from another drop down, then type in the job number they want to assign to it, then type some text for the RTF file then press save. When they press the save it should look out on drive E for the day of week folder, then the shift folder and then create a rtf file within that folder with the job number they gave it.

MAJOR BIG THANKS!!!! IN ADVANCE!!! :o
 
Not sure what you are doing with the String.Format line at the end of your code. If you are trying to generate a full path using String.Format you probably want something closer to
Code:
RichTextBox1.SaveFile(String.Format("E:\{0}\{1}\{2}.rtf", dayofweek , ShiftAssigned, Textbox1.Text))
I would also recomend against using the default control names - in weeks / months to come would you really have a clue what combobox23 meant?
 
Thank you!h

Hey thank you, I will give this new code a try in a little bit and see what happens. Yes, the string was to generate a full path. Like I said, I am really new to VB.NET. I have been teaching myself everything from books and with help from people like you. I love this site and really do appreciate the help of the members here. ;)

Thanks again!
 
Back
Top