![]() ![]() We are able to do this e.g, mnuFileOpen.visible = True and it does make the menu item visible. We want to be able to set the Visible properties of these dropdown items to true and false Each of these toolstripmenuitems has dropdown items. Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.ClickįileWriter.WriteLine(RadioButton1.Name & "|" & ())įileWriter.WriteLine(RadioButton2.Name & "|" & ())įileWriter.We have an application with an mdicontainer form which has a menustrip with many toolstripmenuitems. RadioButton2.Checked = Boolean.Parse(prop(1)) RadioButton1.Checked = Boolean.Parse(prop(1))ĮlseIf String.Equals(prop(0), RadioButton2.Name) Then ![]() ![]() RadioBtn.Checked = Boolean.Parse(prop(1))ĮlseIf String.Equals(prop(0), RadioButton1.Name) Then ' If ComboBox Component set it's propertyĮlseIf String.Equals(prop(0), comboBox.Name) ThenĬomboBox.SelectedIndex = Integer.Parse(prop(1))ĮlseIf String.Equals(prop(0), radioBtn.Name) Then ![]() If String.Equals(prop(0), textBox.Name) Then 'Read the next line and split its value based on the | character If File.Exists("c:tempsampleFile.txt") Then Private Sub LoadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadButton.Clickĭim prop(2) As String ' define array of length 2 Private Sub CloseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseButton.Click Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load The example contains basic error checking including validating that the saved file exists, however it does not validate the data in the file is of the correct format and not corrupted. To see the full example of how the data is processed please view the full source code below.Īfter the loop close the FileReader as all the data has been read.įor those that learn better by example below is a Simple Class that holds a complete example of saving data to a File from a Form in addition to loading the saved data from the form and setting the components to the correct state. In the below example we will read in the file’s contents 1 line at a time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |