I have 2 buttons (Button1, Button2 ) and a RichTextBox1 on a form in a simplified version of my Project. Clicking on each of the three Buttons loads a prespecified file in the RichTextBox. This is through putting (in the Click Event of each of the Button) code such as as this:
Line 1) RichTextBox.LoadFile("c:\T
est\Sample
.rtf")
At the moment I put this code and the path for the file in the click event at the design time and off course I also set the Text property of the Buttons at the design time (in the case of the above example the text property of the Button would be Sample. I would like to have a way of enabling the user of my program to change the file name and the path part of the code (that is "c:\Test\Sample.rtf" part of the code ) in the click event of my Buttons at run time, in a way that it gets saved as well. I would also like my users to be able to change and save the caption (ie Text Property) of the correponding Button1 at run time.
I need advice about how I could possibly achieve that. The actual programme will have not 2 Buttons but perhaps a hundred Buttons but I have given a simplified example. The reason for having a way of saving these changes in the buttons is, of course, so that this step does not have to be repeated the next time users use the programme.
The reason, I want to do this is that I want my users to be able to open prespecified files very quickly through clicking a Command Button without having to go through the usual Open File Dialog Box. I am hoping that once the users have saved a file name and path for a particular command button and the new caption or Text Property, in a way that can be accessed by the click event of the Command Button, the corresponding file will open very quickly. I can save the these things at the moment in design time, but as, off course, the files that need to be opened in this way will change from time to time I want to have some way of allowing my users to change these (and saving the changes) at the runtime. The caption (or the Text Property) of the Buttons will also need to be changed and saved at run time when the underlying file and path name will be changed.
I do not know how difficult it is going to be to do this . If it is not possible to explain the whole way of doing it in one answer to this question, I would like some general guidance on different approaches that can be taken to accomplish this task and will accept that as a solution. Once I have some general guidelines I will try to do it myself or breakdown this problem into multiple separate related questions.
Thank you for your help in anticipation.
Start Free Trial