|
-
Feb 7th, 2007, 09:05 AM
#1
Thread Starter
New Member
noob here need helo on declareing
what i want to do is declare and then say
VB Code:
arnold = (App.Path & "\Data\Students\Class 1\Green\Arnold.ini", "Student", "4")
but i want is so if i need to use it any where in the program i can just put arnold if you see what i mean.
there are going to me 32 names used so is there a way to do it in a module? cheers gareth
-
Feb 7th, 2007, 09:11 AM
#2
Re: noob here need helo on declareing
What's that? looks like paramaters to a Sub without the Sub name. Are you trying to read data from an INI file?
-
Feb 7th, 2007, 09:18 AM
#3
Thread Starter
New Member
Re: noob here need helo on declareing
yes i am i have that all working but the ReadIniValue is not there because i just want to say some where along the line ReadIniValue arnold and then it will look at the ini file that has been declared with arnold .
-
Feb 7th, 2007, 09:25 AM
#4
Re: noob here need helo on declareing
maybe something like this? Using a UDT
VB Code:
Private Type INIData
sPath As String
sSection As String
sLine As String
End Type
Dim Arnold As INIData
Private Sub Command1_Click()
ReadINI Arnold
End Sub
Private Sub Form_Load()
Arnold.sPath = App.Path & "\Data\Students\Class 1\Green\Arnold.ini"
Arnold.sSection = "Student"
Arnold.sLine = "4"
End Sub
Private Function ReadINI(sData As INIData) As String
'Here is where you pass in the data to your INI read function
'Just an example
'ReadIniValue sData.sPath, sData.sSection, sData.sLine
End Function
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 7th, 2007, 09:38 AM
#5
Thread Starter
New Member
Re: noob here need helo on declareing
thanks thats a nice bit of code! its allmost what im looking for. i just want arnold to = (App.Path & "\Data\Students\Class 1\Green\Arnold.ini", "Student", "4") so if i did ReadIniValue or WriteIniValue i could just put arnold and i could do that on any form in the program
-
Feb 7th, 2007, 10:05 AM
#6
Re: noob here need helo on declareing
I would do it this way
VB Code:
Public Function ReadINI(sSection As String, sPath As String, sName As String) As String
'Here is where you pass in the data to your INI read function
End Function
Private Sub Command1_Click()
ReadINI "Student", App.Path & "\Data\Students\Class 1\Green\", "Arnold"
End Sub
I would also have a drop down combo box containing all the names that you need. I would have another drop down combo contains the INI file section names. With that, your user could selection what section and what name, so you would do
VB Code:
Private Sub Command1_Click()
ReadINI, cboSection.Text, App.Path & "\Data\Students\Class 1\Green\", cboName.Text
End Sub
-
Feb 7th, 2007, 10:16 AM
#7
Thread Starter
New Member
Re: noob here need helo on declareing
wow man that is sweet just how i want it but sorry to be a pain and i would love it if you could do this for me: i have 6 classes an to houses green and yellow using the last bit of code you wrote and combo dropdown boxes could you please write the could! i really appreciate what you written so far
-
Feb 7th, 2007, 10:37 AM
#8
Re: noob here need helo on declareing
Do you know how to add items to a combo box or a listbox?
-
Feb 7th, 2007, 10:44 AM
#9
Thread Starter
New Member
Re: noob here need helo on declareing
yer i just trying to think how to do that
-
Feb 7th, 2007, 10:57 AM
#10
Fanatic Member
Re: noob here need helo on declareing
This one is easy!
1) Make a Module
2) Declare your string like this: Global Arnold as String
3) On your main form that loads up first, under Load or Activate, put in your arnold = whatever code and your set.. Anywhere in the program you can say Arnold = whatever, or whatever = arnold, or use it however you wish.
-
Feb 7th, 2007, 10:59 AM
#11
Re: noob here need helo on declareing
 Originally Posted by gareth_2007
yer i just trying to think how to do that
Use the Additem method
VB Code:
Combo1.Additem "Whatever"
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
|