SSTABS and FILE LIST BOXES

I want to know how can I set the path to file directory boxes. I have a SSTAB (on the SSTAB a file list box), and I want whenever you change from one tab to another the contents of the file directory box change also. Could you give me the coding that I would need to use?
ProtorianAsked:
Who is Participating?
 
TorusConnect With a Mentor Commented:
Put the code to the SSTAB click event

sub SSTAB1_CLICK(PreviousTab as integer)

case select sstab1.tab
case 1
      File1.Path = "YourDirectory1"
case 2
      File1.Path = "YourDirectory2"          
.
.
.
end select

end sub.
 
0
 
ProtorianAuthor Commented:
I have tried the code that you gave me, I had to make a change.
I was getting an error with

case select sstab1.tab

so I read the help and changed it to

select case sstab1.tab and the error is now gone.
but I have an error at the File1.Path = "C:\Temp"
IT asks you if you want to end or debug the code.

0
 
TorusCommented:
Sorry that I have a typed mistake.
Yup, it should be select case.

BTW, what the error and error code did you get? Are you sure that there is
a directory "C:\TEMP"?


0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
ProtorianAuthor Commented:
Yes there is a directory called C:\Temp
This is the error message that I get

Run-time error '424':

Object Required
0
 
TorusCommented:
Can you post what exactly your code here?
The error seems not relate to the File1.Path = "C:\TEMP"


0
 
ProtorianAuthor Commented:
Private Sub SSTab1_Click(PreviousTab As Integer)
  Select Case SSTab1.Tab
    Case 1
      File1.Path = "C:\temp"
    Case 2
      File1.Path = "C:\CkBook"
  End Select

End Sub

0
 
TorusCommented:
have you get the same error in the File1.Path = "C:\CkBook"
? BTW, you File List control is added at run time or design time? really no idea why you got the error. I have no problem in VB6 SP3


0
 
TorusCommented:
ok, I got your error. I may misunderstand. If you want
to change the content of a file list box, File1.path.
If you want to change the dir Listbox, put dir1.path
Also make sure that the name of the control is File1 or
dir1. Otherwise, you need to put <YourControlName>.path
instead. If not, the error will occur
0
 
ProtorianAuthor Commented:
This is exactly what I have


Private Sub SSTab1_Click(PreviousTab As Integer)
  Select Case SSTab1.Tab
    Case 1
      File1.Path = "C:\temp"
    Case 2
      File1.Path = "C:\CkBook"

  End Select

End Sub



I have even tried to manually set the directory

Private Sub SSTab1_Click(PreviousTab As Integer)
  Select Case SSTab1.Tab
    Case 1
      Dir1.Path = "C:\CkBook"
      File1.Path = "C:\CkBook"
   End Select

End Sub


But this does not work either.
I get the same error message
0
 
TorusCommented:
Did you add the controls to your form or sstab?
The error just occurs if you haven't added the control to
the form or your controls' name doesn't match Dir1 and
File1
0
 
ProtorianAuthor Commented:
I have still not gotten it to work.
But I decided to give you the points any way
0
All Courses

From novice to tech pro — start learning today.