Post: [NEED HELP] Visual Basic??
03-11-2011, 01:59 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Hi, i am using Visual Studio 2010 (Visual Basic) and i have started to create a program, the problem is i have linked a BROWSE button to a FolderBrowseDialog and when i have selected a folder to open the text in the textbox doesnt change to the chosen folder path. Does anyone know how to make the textbox display the folder path for the chosen folder?

Another problem is that i have a button that i want to link to a .exe console application, does anyone know how to link it so that when i click the button the BROWSED file will open in the .exe console application?

Thanks in advance will +rep for solutions.
03-11-2011, 05:00 PM #2
It would help if you posted the source code, many visual basic programmers browse this section and would be able to help you.
03-11-2011, 08:04 PM #3
Default Avatar
Oneup
Guest
Originally posted by Harvinder View Post
Hi, i am using Visual Studio 2010 (Visual Basic) and i have started to create a program, the problem is i have linked a BROWSE button to a FolderBrowseDialog and when i have selected a folder to open the text in the textbox doesnt change to the chosen folder path. Does anyone know how to make the textbox display the folder path for the chosen folder?

Another problem is that i have a button that i want to link to a .exe console application, does anyone know how to link it so that when i click the button the BROWSED file will open in the .exe console application?

Thanks in advance will +rep for solutions.


I'm assuming this is what you want for the first part:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim openFolder As New FolderBrowserDialog

openFolder.ShowDialog()
pathTextBox.Text = openFolder.SelectedPath
End Sub



2nd part:
    Imports System.IO
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim openExe As New OpenFileDialog



openExe.ShowDialog()
Process.Start(openExe.FileName)
End Sub
03-11-2011, 10:57 PM #4
Originally posted by TheUberFail View Post
It would help if you posted the source code, many visual basic programmers browse this section and would be able to help you.


This is the code i use to display the folder dialog, but cant seem to get the path to be displayed the text box:

Originally posted by another user
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
FolderBrowserDialog1.ShowDialog()
End Sub


And this is the code i use to open the file dialog and browse for a file which then the path is displyed in a text box:

Originally posted by another user
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
End Sub

Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
TextBox1.Text = OpenFileDialog1.FileName
End Sub


But when this file has been displayed into the text box i want to execute it in a .exe console application with another button.

Thanks.

---------- Post added at 10:57 PM ---------- Previous post was at 10:57 PM ----------

Originally posted by UP View Post
I'm assuming this is what you want for the first part:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim openFolder As New FolderBrowserDialog

openFolder.ShowDialog()
pathTextBox.Text = openFolder.SelectedPath
End Sub



2nd part:
    Imports System.IO
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim openExe As New OpenFileDialog



openExe.ShowDialog()
Process.Start(openExe.FileName)
End Sub


I will try these out now and get back to you thanks.
03-11-2011, 11:22 PM #5
Originally posted by Harvinder View Post
This is the code i use to display the folder dialog, but cant seem to get the path to be displayed the text box:



And this is the code i use to open the file dialog and browse for a file which then the path is displyed in a text box:



But when this file has been displayed into the text box i want to execute it in a .exe console application with another button.

Thanks.

---------- Post added at 10:57 PM ---------- Previous post was at 10:57 PM ----------



I will try these out now and get back to you thanks.


Or you could use simplicity and do it the easy way.

            OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName


Or once the person has selected the file, if you want it to open use this.

        OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
Process.Start(OpenFileDialog1.FileName)
03-11-2011, 11:32 PM #6
Originally posted by UP View Post
I'm assuming this is what you want for the first part:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim openFolder As New FolderBrowserDialog

openFolder.ShowDialog()
pathTextBox.Text = openFolder.SelectedPath
End Sub



2nd part:
    Imports System.IO
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim openExe As New OpenFileDialog



openExe.ShowDialog()
Process.Start(openExe.FileName)
End Sub


The second code works but it isnt what im looking for. here is a image example of what i am trying to do:

You must login or register to view this content.

---------- Post added at 11:32 PM ---------- Previous post was at 11:29 PM ----------

Originally posted by aNut View Post
Or you could use simplicity and do it the easy way.

            OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName


This only works for OpenFileDialog, im using the FolderBrowseDialog which doesnt have that option?

Originally posted by aNut View Post
Or once the person has selected the file, if you want it to open use this.

        OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
Process.Start(OpenFileDialog1.FileName)


ive tried that but its not what i want it to do. i want to do this:

You must login or register to view this content.
03-11-2011, 11:42 PM #7
Originally posted by Harvinder View Post
The second code works but it isnt what im looking for. here is a image example of what i am trying to do:

You must login or register to view this content.

---------- Post added at 11:32 PM ---------- Previous post was at 11:29 PM ----------



This only works for OpenFileDialog, im using the FolderBrowseDialog which doesnt have that option?



ive tried that but its not what i want it to do. i want to do this:

You must login or register to view this content.


Then use OpenFileDialog instead of the FolderBrowseDialog as the clue is in the name 'FOLDER' it will not show you items such as the files in the folder, it will only show you the folder structure (tree).
03-12-2011, 12:13 AM #8
Yeah i want to see the folder sructure not the files, plus i have to use folderbrowsedialog because the command is to open a folder not a file???
03-12-2011, 12:24 AM #9
Originally posted by Harvinder View Post
Yeah i want to see the folder sructure not the files, plus i have to use folderbrowsedialog because the command is to open a folder not a file???


To be honest you have over complicated this, and it would be easy if you had MSN. If you do add me and I will help you straight away.


MSN: [email][email protected][/email]
03-12-2011, 02:04 AM #10
ive added you on msn.

CAN ANYONE ELSE HELP ME?
Last edited by Harvinder ; 03-13-2011 at 09:56 PM.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo