stu nicholls dot com | menu - Professional dropdown #3

OpenFileDialog

Displays a dialog box that prompts the user to open a file.

In the following application OpenFileDialog, TextBox, Button and PictureBox controls are added (shown in Fig. 14). When you click the Button, a dialog box prompting you to select the file which you want to open will be displayed and select the file then the selected picture file will be displayed in the PictureBox and the location of the file is displayed in the text box (shown in Fig. 15 and Fig. 16).

Public Class Form1
Dim strn As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
strn = OpenFileDialog1.FileName()
TextBox1.Text = strn
PictureBox1.Image =
Image.FromFile(OpenFileDialog1.FileName)
End Sub
End Class

Fig21


Fig22


Fig23


SaveFileDialog: Displays a dialog box that prompts the user to select a location for saving a file.

TrackBar: Enables the user to choose between ranges of values by sliding a small bar along another bar.

Splitter: Divides a container’s display area into two areas which can be resized.

TreeView: Displays a hierarchical collection of labeled items to the user that optionally contain an image.

The labeled items are represented by a node and referred to as the TreeNode. The first node is the Root Node and any subsequent node added is known as the child node.

In the following application one TreeView, two Splitter and two Textbox controls are added.

  1. Add the TreeView control to your application (shown in Fig. 17)and set the Dock Property to Left (shown in Fig. 18). Fig24


    Fig25


  2. Adding the Tree Nodes:
  3. In the Properties window, click on to Node (Collection)
  4. Select Edit Nodes. The TreeNode Editor appears (shown in Fig. 19).
  5. Fig26


  6. First add the Root node by clicking on to the button Add Root button (shown in Fig. 20). Then you can change the name for the node (shown in Fig. 21. In our case MGM is the name of the root node).
  7. Fig27


    Fig28


  8. 5) You can add the child nodes and again give names to it. Following diagrams show the different child nodes added (shown in Fig. 29-34).
  9. Fig29


    Fig30


    Fig31


    Fig32


    Fig33


    Fig34


  10. Now add the Splitter control and it will automatically dock to the right edge of the TreeView control (shown in Fig. 35).
  11. Fig35


  12. Now add the TextBox control to the application and change the following properties as Dock = Top, Multiline = True and set the Text property blank (shown in Fig.36).
  13. Fig36


  14. Now again add one more splitter control and make the Dock property of it to Top. It will now dock to the bottom of the TextBox control (shown in Fig. 37).
  15. Now add the RichText Box control and set the Dock property for Fill and set the Text property blank (shown in Fig. 37).

  16. Fig37


>>Program

<< Previous   Next>>


comments powered by Disqus
click here
click here
Footer1