473,411 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Vbform

Hi All,

I Created a form and now i want to add a command button and a text box
and then when user clicks on command button browse window should open and users can select the path and seleted path should be shown in text box.

Cheer's
Harsha
May 20 '09 #1
1 1272
mshmyob
904 Expert 512MB
Assuming you have a form with a text box and a button.

Following code is in a module

Expand|Select|Wrap|Line Numbers
  1. Public Function fPickDirDialog(txtSelectedDir As String) As String
  2.  
  3.    ' Requires reference to Microsoft Office 12.0 Object Library.
  4.  
  5.    Dim fDirDialog As Office.FileDialog
  6.  
  7.    ' Set up the File Dialog to show only directories
  8.    Set fDirDialog = Application.FileDialog(msoFileDialogFolderPicker)
  9.  
  10.    With fDirDialog
  11.  
  12.       ' Allow user to make a single selection in dialog box
  13.       .AllowMultiSelect = False
  14.  
  15.       ' Set the title of the dialog box.
  16.       .Title = "Please select a directory"
  17.  
  18.  
  19.       ' Show the dialog box. If the .Show method returns True, the
  20.       ' user picked at least one dir. If the .Show method returns
  21.       ' False, the user clicked Cancel.
  22.       If .Show = True Then
  23.             ' return the directory and path chosen
  24.             fPickDirDialog = .SelectedItems(1)
  25.       Else
  26.             fPickDirDialog = txtSelectedDir
  27.       End If
  28.    End With
  29. End Function
  30.  
Following code is in the OnClick event of your button:

Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me.txtYourTextBox) Then Me.txtYourTextBox= "C:\"
  2. Me.txtYourTextBox= fPickDirDialog(Me.txtYourTextBox)
  3.  
cheers,

@harshakusam
May 20 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
4
by: Tom | last post by:
Hi .Net Professional : In recent , I starting to learn about dynamic call .net object in vb.net. Before, some IT people teach me use the following method and its work !! Dim asm As =...
1
by: MAIjah | last post by:
Sorry, just a newbie and what I call a 'bruteforce' programmer. I'm using a VBform in EXCEL to pass info to a worksheet. I have 7 option buttons (exclusive?, only one can be true) and want to...
3
by: =?Utf-8?B?QnJhZA==?= | last post by:
im trying to create a vfp app that can talk to a vb 2005 app to launch forms basically, i want to tell the vfp app to launch a form when they select an option from the vb menu that hasnt been...
11
pbmods
by: pbmods | last post by:
A somewhat obscure hack has emerged recently that is an offshoot of the now-infamous XSS. It is known as Cross-Site Request Forgery, or XSRF for short. XSRF is a form of temporary identity theft...
12
getgagan
by: getgagan | last post by:
How to print text contained in controls using vb6.0
1
by: samadams_2006 | last post by:
Hello, I have an unbound DataGridView on a VBForm, and I would like to display an icon or image in the first column of a record to indicate what type of record it is. For example, error...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.