|
-
Aug 22nd, 2000, 08:56 PM
#1
Thread Starter
Junior Member
In program that I am doing for a non-profit org. There are 2 languages being used.
I have 2 command buttons cmdFrench and cmdEnglish that set all the captions, msgbox, inputbox, lbs, etc the the language clicked.
(Note: this might not be the right way of doing it but heck, it worked, with alot of typing, were talking 15 forms)
But the question is how do I get the app to load with the last users default language?
Also should I put in all the code in the seperate command buttons or use one button with if else. ( I thought that seperate buttons that I would be better able to recall the last language.
Thanks,
VB newbie
Randy
-
Aug 22nd, 2000, 09:09 PM
#2
Frenzied Member
ok... here it is:
Code:
Private Sub cmdenglish_Click()
Open "c:\lan.dat" For Output As #1
Write #1, "English"
Close #1
End Sub
Private Sub cmdfrench_Click()
Open "C:\lan.dat" For Output As #2
Write #2, "French"
Close #2
End Sub
Private Sub Form_Load()
On Error Resume Next
strItem1 As String
Open "C:\lan.dat" For Input As #3
Input #3, strItem1
Close #3
If strItem1 = "English" Then
'code for english
Else
If strItem1 = "French" Then
'code for french
End If
End If
End Sub
NXSupport - Your one-stop source for computer help
-
Aug 22nd, 2000, 09:29 PM
#3
Thread Starter
Junior Member
Thanks
So you are saying to put the code in the form load event of form 1, and that the info would be saved in the "lan( or what ever).dat" file.
Now I know alot of people that have the habit of deleting files on the root drive.
Is there a way that the file can be saved in the same dir as the app. Not knowing on what drive or the name of the file is to be. This will be done by the user during setup.
If I have other user prefs to keep, would I put them into the same file?
Thanks again
Randy
-
Aug 22nd, 2000, 09:37 PM
#4
Frenzied Member
If I were you I would just put it in the windows folder
"c:\windows\lan.dat"
but to get it to be in the same folder as your program, I'm just getting this from the top of my head, it might not work:
Code:
App.Path & "\lan.dat"
NXSupport - Your one-stop source for computer help
-
Aug 22nd, 2000, 09:43 PM
#5
Hyperactive Member
Hi,
I've done apps in different languages and found the Resource file very usefull tool to store the language strings. Check your VB help for how to use resource files.
Also for storing the last language used consider registry:
'Declare public var in a module
Public Language as String
'------------------------------------------------------
Sub Form_Load()
Language = GetSetting("App", "Options", "Language", "E")
if Language = "E" then
SetEnglishLanguage
else
SetFrenchLanguage
end if
End Sub
'------------------------------------------------------
Sub Form_Unload()
SaveSetting "App", "Options", "Language", Language
End Sub
Hope that helps
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|