Multiple Variant Values To One Variable
How could I store multiple values of any type to one variable? I also am wondering, if at times I could just use one of these variables. Thankx a lot!
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Multiple Values For A Variable
Hello World!
I am looking for a way to make a variable have multiple values, but not really like an array...for example:
Blah = 25,200,0,1,rgb(0,0,255),0,0,0)
right now the way I have stuff done is really bulky, but if I could do that, I could reduce my stuff to a few lines of code...any suggestions??
Save Multiple Values In One Variable
This has probably been asked and answered, but I could not find anything. Anyway, here's what I want to do:
I have a button that's randomizing values that are shown in a TextBox. What I want to do is to prevent the same value form showing up again. I know that I somehow should be able save the values to a variable, like
Private used_values(1 To 100) As Integer
search through the variable with a for loop and if the randomized value is already in the variable I just have to randomize again till i get a value not previously displayed. The thing is, I don't know in detail how to do this so an explanation would be greatly appreciated.
----------------------
Using VB 6.0 (SP5)
Edited by - ATIKO on 6/2/2005 3:41:31 PM
Setting Multiple Variable Values In A Loop
Hello,
I am trying to set the values of multiple variables with sequential names like in the code below which of course dosent work, I have looked around and cannot find the answer does anyvody know?:
In php this is called a "variable variable", where you set a variable a value and you call that variable with the name as that value: like this: $$variable
Thank You.
the Code:
------------------------------------------------
Private Sub Command1_Click()
Dim mojo1 As String
Dim mojo2 As String
Dim mojo3 As String
Dim mojo4 As String
Dim mojo5 As String
For i = 1 To 5
"mojo" & i = "some value" 'How do I set the values?
Next i
End Sub
------------------------------------------------
Maintaining Variable's Values Across Multiple Controls
OK, so when my user clicks my "Modify" button, a record is retrieved from our database, and if there is an "$H" string in row 13, column 40, then the value of SNAXCHECK (an Integer) should equal one.
The code looks like this:
SNA = CrtGet$(13,40,1)
If SNA = "$H" then SNAXCHECK = 1 else SNAXCHECK = 0
Later on during the program's execution, the user will click the "Modify Page 2" button, and it is only THEN that the value of SNAXCHECK should come into play. (It bears pointing out that by this point, the original data on the CRT has been replaced. Whether it was "$H" or not when it was retrieved, it is now "$W." That's part of what my program accomplishes. I point it out because I fear that once that field has been changed on the CRT, the value of SNA changes as well. Is there a way to make the value of SNA ABSOLUTE, for the remainder of the program, once it's initially retrieved by CrtGet?)
Within my Page 2 button_click script is this:
If SNAXCHECK = 1 then
label16.visible = 1
label17.visible = 1
label18.caption = SNAXID
label18.visible = 1
End if
But, it doesn't work. That is, even when SNA clearly equalled "$H" (I have a number of checks in place that confirm this), causing SNAXCHECK to equal 1, labels 16-18 do not become visible, and the value of SNAXID does NOT appear - even thought it appeared correctly when they clicked "Modify."
Is it the case that the integer value of SNAXCHECK only survives during the execution of the script for Modify_click?
Inputting Multiple Variable Values Inside A File [SOLVED, Thank You]
I have a variable called BlkdAddrs. I'm trying to get my program to input each value on a separate line, using the following code:
VB Code:
Open App.Path & "BlockedList.lst" For Output As #1 Print #1, BlkdAddrs & vbCrLfClose #1
However, when I look inside the file, all values are on a single line. How do I get each value on its own line?
Example: <Name@ISP.com><Name2@ISP.com> should look like this:
<Name@ISP.com>
<Name2@ISP.com>
How To Assign A Cell/Range Address In A Variant Type Variable To Another Variable
Sir,
I have the following piece of code which looks up a certain date in several wrksheets and aims to return the value in a cell located in the next two columns (same row) where my look up value is.
For i = 1 To 23
Worksheets(strFilename(i)).Activate
Range("C4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.NumberFormat = "[$-409]dd-mmm-yy;@"
Dim strFilename(1 To 23) As String, strFilename2(1 To 23) As String, strPath As String
Dim dtActProg As Date
Dim rngSearch As Variant
Dim c As Variant, c1 As Variant
Set rngSearch = ActiveCell.CurrentRegion
With Worksheets(strFilename(i)).Range(rngSearch.Address)
Set c = .Find(dtActProg, LookIn:=xlFormulas)
If Not c Is Nothing Then
Sheets("Sheet1").Select
Cells(i, 2) = c.Value
' Returns the date I enter via an Inputbox in the privous section of my code
' In the remaining section of my code I need to assign the address of the cell located in the 2nd column next to where code looks up date value assing it to a variable and return the value on Sheet1 next to where code writes c.vale
For example if c.address="$A$2" then c1.address must ve "$A$4 which will be listed on Sheet1 together with my dates entered via ListBox
End If
End With
Next i
Thanks,
Fatih Can
Petroleum Eng., MSc.
Null Values In Variant Array
Let's say you have a CSV file and you load it into a variant array using the
split function on VBCrLF. Then you load a variable with the line count and
loop through the array for 0 to line count. This works well unless you have
blank lines at the end of the CSV file. Now if you process the loop, you'll
get an out of bounds subscript at the end of the loop because you are
referencing null values at the end of the variant array.
How would you go about stripping the extraneous CRLFs from the end of the
file?
Paul
Loading XML Into A Variant Variable...
I'm creating a line chart using VML within VB...it eventually gets written to an HTML file. I have it right now to where it creates the line chart using data from an Access database. How to do make it so that it does it with XML? Below is an example of my XML file...don't know if I need to format it another way or not.
Keep in mind...my knowledge of XML is VERY limited. Just learning.
Code:
<?xml version="1.0"?>
<Emp_Counts>
<Counts>
<Type>Office</Type>
<Count>3297</Count>
<PERCENT>19.18</PERCENT>
</Counts>
<Counts>
<Type>Field</Type>
<Count>1100</Count>
<PERCENT>6.40</PERCENT>
</Counts>
<Counts>
<Type>IT</Type>
<Count>11608</Count>
<PERCENT>67.54</PERCENT>
</Counts>
<Counts>
<Type>Labor</Type>
<Count>1183</Count>
<PERCENT>6.88</PERCENT>
</Counts>
</Emp_Counts>
Size Of A Variant Variable
How can we know what exactly is the size of a variant variable?
Integer take 2 bytes, Long take 4 bytes...what about Variant?
Thanks,
How To Get The Pointer From A Variant Variable
Hi everybody,
I have this code:
Public Sub MySub()
Dim nInt as Integer
Call VarSub(nInt)
End Sub
Public Sub VarSub(ByRef vVar As Variant)
' here I need the address of the given variable
End Sub
In the second Sub I need to find out the address (the pointer) of the given variable, nInt in this case, using only the vVar. Thre must be some way to get it, because the VB does the same.
Do you know also the structure of a Variant?
Greetings,
Catalin
Redimensioning A Variant Variable
I want to have a variable that's variant before runtime, and then at runtime, choose from a list of severals UDT's and make it that type.
Ex:
dim something as variant
type a
end type
type b
end type
type c
end type
sub change()
redim something as b '(or a or c)
end sub
Why won't this work?
jmiller
Variant Variable -Can't Display
Hi. I've got a big problem. I'm trying to write a program that attempts to print the a variant variable value
individually. Variable num must be of type Variant and
always holds a 9 digit number.
For example num = 123456789 as variant
I need to display num like this:
1
2
3
4
5 etc
This is the code I wrote:
Option Explicit
Dim num As Variant
Private Sub frmPrint_Click()
Dim obj As Variant
Dim lenNum As Integer
Dim i As Integer
Dim strNumArr(1 To 9) As Variant
num = 123456789
' An attempt to place the first number in variable num as the first element of array strNumarr
For i = 1 To 9
strNumArr(i) = num(1) ' this doesn't work
Next i
For Each obj In strNumArr
Picture1.Print obj
Next
End Sub
Kindly reply. Thanks
Typecasting A Variant Type Variable
I have a variant type variable (being used in the ParamArray statement) where I expect one or more object variables to be received. Inside the procedure I want to access each individual object in the array.
Is there any way I can typecast the variant variable into the actual object I want to use?
.
How To Read Multiple Fields Into Variant
I've another database question. I seem to recall that there a way to read in multiple fields from a recordset using a variant.
Like... these read in 1 value:
Dim S as String
S = MyDbRecSet!Fieldname
S = MyDbRecSet.Fields(1)
S = MyDbRecSet.Fields("name")
But I seem to recall that there's a command that looked like this...
Dim V as Variant
E = MyDbRecSet!Fieldnames
or...
E = MyDbRecSet.Fields(1,2,3,4,5)
...but I can't remember it.
Invalid Procedure/Object Variable/Item...Variant
I keep getting an error in this:
CODEPublic Function Item(ByVal vntIndex As Variant) As StatusLookup
'Select a member from the collection
'A variant is used so that either the ordinal position or the key can
'be used to retrieve the item
'I added this error trap and the invalid procedure error became object variable error
On Error Resume Next
Set Item = mStatusLookup.Item(vntIndex)
End Function
Sending Values Multiple Values To ONE Word File[Resolved Like A Horny Ho']
I have searched for how to do this and have the code to start up a word app: (thanks to Carl)
Option Explicit
VB Code:
Private Sub Command1_Click() Dim WordApp As Word.Application Set WordApp = New Word.Application With WordApp 'create word app from default template .Documents.Add "Normal.dot" 'don't ask me to save before quiting! .DisplayAlerts = wdAlertsNone 'show the word window .Visible = True 'active the window .Activate 'send text to the window .Selection.Text = "Hello World!" 'print the page .PrintOut 'wait for document to print before quiting Do While WordApp.BackgroundPrintingStatus Loop 'quit .Quit End With Set WordApp = Nothing End Sub
But what I need to do is have users check the fields who's values they want to include in a report and have the word file as the report. Here's a GIF of what I mean:
The checkboxes indicate the values and field names to be included in the word document.
Does anyone know how to do this/a tutorial for this?
thank you xxxx
Converting From Type Variant To String When Variant Is Empty.
Hi All.
Trying to convert a variant to type String when I know that the variant is Empty or NULL
For those familiar with the "Split" function in VB6 and the backport to VB 5.0 that was made I am using that Split Function.Code:Dim cN As Variant
Dim complexName As String
cN = common_split("Divide", "_")
If (cN = Null) Then ' This line goes BOOM
complexName = componentTable(componentNum).componentVariable_p(sourceIndex).name
Else
complexName = CStr(cN)
End If
' Split function
Public Function common_split(ByVal TextToSplit As String, Optional ByVal Delimiter As String = " ") As Variant
If TextToSplit = "" Then Exit Function
Dim TempStr As String, tempArr() As String
Dim x As Long
On Error Resume Next
If Delimiter <> "" Then
Do
x = InStr(TextToSplit, Delimiter)
If x <> 0 Then
TempStr = Left(TextToSplit, x - 1)
TextToSplit = Right(TextToSplit, Len(TextToSplit) - x + 1 - Len(Delimiter))
ReDim Preserve tempArr(UBound(tempArr) + 1) As String
If Err Then ReDim tempArr(0) As String: Err = 0
tempArr(UBound(tempArr)) = TempStr
End If
Loop While x <> 0
End If
If TextToSplit <> "" Then
ReDim Preserve tempArr(UBound(tempArr) + 1) As String
If Err Then ReDim tempArr(0) As String
tempArr(UBound(tempArr)) = TextToSplit
End If
common_split = tempArr()
End Function ' End of function common_split
Anybody see whats wrong with this?
Edit: I AM THE WORLDS ULTIMATE DUMB ASS. IGNORE ME. NO! IN FACT, THROW STONES AT ME AS I AM SO STUPID I DESERVE IT.
Code:If (cN(0) = Null) Then
Edited by - Steven_Cox123@yahoo.com on 12/8/2003 8:49:59 AM
How To Copy Data In Variant Array To The Single Variant
Iam using one VB Application in which Iam using VariantArray and variant
Dim PixelData() as Variant.
Dim TempPixelData as Variant
I think it is a two dimensional Array.
How to copy the elements in pixeldata to TempPixelData.
Iam give Pixeldata as an argument to the vc++ application.
When I check the dimensions in vc Iam getting single
Thats why I want to copy it to the Single Variant .
Can any body please help me?It's very urgent....
Thanks In Advance,
Meka
Updating Multiple Records Using Single Field Multiple Values..
dear
i have a flex in whcih i am displaying records.
lets say there are 5 records in the flex, with srno 1, 2, 3, 4, 5 and out of these 5 records i want to update 3 records srno 1, 3, 5.
srno date
1 01/12/2005
2 02/12/2005
3 10/12/2005
4 10/12/2005
5 11/12/2005
Like in delete statement we use this syntax.
delete * from tablename where fieldname in ("fieldvalue")
can we use the same concept for updating single field date in my case
can we use update like given below
update tablename set date = " & "'" & Format(Date, "dd-MM-yyyy") & "'" & " where srno in ("1,3,5")
But even after using the above syntax my data is not updated and also im not getting any error msg
hope to get helpful replies
regards
ladoo
Variable Values
In Excel how do you make a variable hold a value until you the workbook is closed?
I have a workbook that when you open it a form pops up with a list of databases for the user to select. When the user selects a database the code assigns that value to a variable(g_dbs = lst.text).
Then there is a run query button("select * from g_dbs") in the workbook. It works great the first time the user runs the query but the next time g_dbs = ""
I don't understand why it is losing the value after running a routine once. I've never had a problem with this in vb 6 or vb.net. Any help would be greatly appreciatied
Variable Values
Hi,
When I use the code (as below), the public variable gets changed when all I want to do is use it in the sub procedure????
say Bday is 5/4/75 at the beginning, it ends up being 6/4/75 at then end.
Public Bday as date
Public iResult as integer
Call NoDays(today, Bday)
.....
.....
Sub NoDays(Day1, Day2)
Day 2 = Day2 + 1
iResult = DateDiff("d", day1, day2)
End Sub
Variable Of Set Values?
Hey- What i'd like to do is create a variable that can only have certain values, like for instance the vbcolor constants where if you declare a variable as one it can only be vbred or vbblue etc. Im not sure if i do this with a user defined type or class or what. Can someone please explain it? If you still dont understand what i mean then tell me and i'll try to clarify it more....
Thnx For Your Time,
CarlosTheJackal
Variable Values Between Exe's
Hello,
I am new on VB6 and a have this dificulty...
... I would like to send a variable value between two vb.exe programs.
Example:
Program 1:
Write in memory a "xpto" variable
Program 2:
Read from memory the xpto variable value
This exe files are completely distinct projects.
Is it possible?
If it is, how?
Comparing Two Variable Values
Sorry if this has been posted before (i am sure it must of as would seem to be a common need) but i have had a search of the forums and not found anything close enough.
Basically i have a variable called 'checkcell' and a variable called 'matchcell'.
The value of checkcell is always a 8 didgit number read from a cell ie "12345678". However the contents of matchcell is a combination of text and numbers, the numbers normally being a 8 didgit number, however not always. ie "Mr Jones 12345678 cciij887kjhh". I am trying to get create a function that will feturn "True" if checkcell is contained in matchcell (thus the above example would return true).
From looking in the VBA Help file it seems that built in find method returns a range, which is not what i require. However i am stumped as to how i can achieve this.
Is there an inbuilt excel function for this that i can use, or another VBA function that will produce the same result.
Cheers in advance,
nairnie
Saving Variable Values
Hi, I was wondering if there is a way to save the values of variables in VBA macros in the Workbook the macro is contained in without saving the values in a sheet. I know that with Word, you can use Document Variables to store values within the document but I was wondering if there is anything like that for Excel. Or is there a way you can store information about an individual sheet without putting the data on the actual sheet in a hidden cell somewhere or out of sight at the bottom.
Variable To Take On Comboboxes Values.
Hi I have a problem here and really need help.
I have 3 comboboxes Material, Type and Size.
In the Material combobox, there are 2 choices, AA and BB.
In the Type combo are 2 choices, 1 and 2.
In the Type combo 2 choices, 20 and 30.
I need to have 3 variables taking on the values in these comboboxes. 3 variables, say ,
Quote:
Dim vmaterial, vtype,vsize
So vmaterial must take on values of AA or BB.
vtype must take on values of 1 or 2.
vsize must take on values of 20 or 30.
First I need to add my comboboxes values which is
Quote:
Combo1.AddItem "AA"
Combo1.AddItem "BB"
Combo2.AddItem "1"
Combo2.AddItem "2"
Combo3.AddItem "20"
Combo3.AddItem "30"
Is the command
vmaterial = Combo1.List(Combo1.Listindex)
vtype = Combo1.List(Combo1.Listindex)
vsize = Combo1.List(Combo1.Listindex)
where Combo1,Combo2 and Combo3 are the comboboxes for Material,Type and Size?
Getting Variable Values From Other Frms
hi there.
I have 2 forms, frmmain and frmother.
in frmother, I declared a global variable and works fine within that frm
but if I wanted to access/see what value this global variable has in frmother from frmmain, how would I do this?
Clear Variable Values
hi,
i have a project which uses a form to enter details then passes them to another form to be processed. i have a command button on here to go back to the main form to proccess another.
however, it retains the values of the first entry in all the text boxes on the second form. do i need to empty the variables somehow when the second form is closed? they are all in a module.
thanks for your help
Simon.
Omg VB Isn't Showing Me Variable Values!
All of a sudden when I get an error, or I mark VB to stop at a line of code, it won't tell me what the variable value is when I put the cursor over it! How do I fix this? It's REALLY pissing me off
Exporting Variable Values To A .txt???
Hi, I've developed a program which holds variables about a person that I type in. Then, when the program is closed, the data is lost and the variable values reset. I wanted to know if it was possible to export cetain variables data to a .txt when a button is pressed. Then when that button is pressed again, the new set of data will then be sent to the same .txt file on a new line.
Is this possible?
Thanks all
Getting PDF Values Of A Form To VB Variable
Can anyone please help.
I am trying to get the values of the fields that I filled in the pdf form and putting it in vb variables.
For example:
I want someone to go to my program and fill out the pdf form the when that person clicks on submit it sends all the things filled in the form the vb variables.
Can someone give me an idea.
Passing Variable Values
Let's say, for simplicity sake, I have a little VB program (named TEST.EXE) that has but one module in it:
Public Sub Main()
Dim myName as String
myName = "MyTestName"
'some code needs to go here - but what?
End Sub
This program is compiled into an .EXE and will be executed via the command line - not via the Windows interface.
I want the program to return MyTestName to the command line when the program is executed. So, a sample session would look like:
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.
C:> TEST.EXE
MyTestName
C:>
Essentially I need to write to the standard output device when the program is run. This is cake in C or Java, but I'm clueless as to how it's done in VB.
Anybody?
I suppose I could write to some dummy disk file then have the shell script read it...
Very Large Variable Values?
How would I store something like this in a variable?
50 ^ 2789=2.675112761552455853275298470622e+4738
double only goes to what.. +400?
always equals an overflow...
-BR
Saving Variable Values
Is there a way to save values of variables (aside from storing values in a db or txt file) when a VB app closes such that when it is run again, the defaults are what was saved the last time the program was used.
Passing Variable Values
I want to make use of passed variable values in VB5.0 and then I want to again pass those values to a .bat file. How to? Thanks.
Separating Values In A Variable
I am using excel and have a cell where a user enters "\servernamesharenamefolder1
unfolder"
What I need to do is break up "servername", "sharename" and "folder1
unfolder" into 3 different variables in a sub routine. as a VB newbie, how would I do this?
Get Enum-values With Variable?
I have bit of a problem with enum.
The base story is that the enum membernames is not allowed to contain invalid characters as in my case "-". Instead i have done a wrapper that replaces the "-" with "_" wich ought to work in my case. But when the translation is done i want to read the the translated line from a enum...
Heres th code:
PHP Code:
Protected Overridable Function ReadFloatPre(ByVal CHECK As String, Optional ByVal enflags As enRFlags = 0)
Dim fval As String
Dim strToConv = CHECK
Dim enNTF_OKI As Int32
Dim enNTF_OK As DOLA.enNTF_CHK 'This is the enum relacement
Dim strBeenConv = Replace(strToConv, "-", "_") 'The replacement of characters
LogArray(strToConv, strBeenConv) 'Just a printout of the text
enNTF_OKI = enNTF_OK.Format(strBeenConv) 'My latest try
End Function
Thanks !!
Can A Variable Hold Two Or More Values
hello again
so staight to the problem, here it is:
i need to be able to check if the last 3 characters of a txt box are what i will be allowing, i will be allowing certain audio files, for example i will only be allowing - mp3, ogg, wma. now can i store all those values in one variable.
heres what im using so far:
Code:If Right(txtFILE.Text, 3) = "mp3" Then
but i need it to allow others aswell.
i cant just do this though
Code:If Right(txtFILE.Text, 3) = "mp3" or "wma" or "ogg" Then
so i could really use help in either storing all the allowed file extensions in one variable, or some other way of doing it.
thank you
Primary_Slave
Edited by - Primary_Slave on 9/13/2004 3:07:20 PM
Environment Variable Values?
I need to write a chunk of VB code to retrieve the value of an environment variable (such as PATH, INCLUDE, LIB, etc. - you know, from the DOS autoexec.bat?)
Anyone here know how to do that easily in VB?
Thanks! I know it's a basic type question - I just don't have the means to research it right now.
- killRoy
Variant Defining A Variant
Hi, Im looking for a bit of advice. Im an intermediate vb programmer, yet somehow I cannot manage to secure working code for this function...
My goal is to have a variable define what picturebox to send information to...my code is as follows:
Dim imgbox As PictureBox
Dim tilex, tiley As Integer
dim x, y, a, b as integer
x = 500
y = 500
a = 0
do
b = x + a
Set imgbox = "X" & b & "Y" & y
......./
The problem is that whenever the code is run, its returning error 424 "Object Required"
If anybody could shine some light on a possible solution for this, i would be most appreciative..
Many Thanks
Ross Spencer
Is There A Way To Transfer Variable Values Between Controls
without having to name the control reference specifically?
Private sub Form1_Click()
call Form2_Load(text1.text)
end sub
Private sub Form2_Load(x$)
Form2.text1.text=x$
end sub
Is there a correct format for doing this? I'm trying to create a plug-in module that will allow me to do the same function over several applications.
thanx
Sharing Variable Values In 2 Different Forms
Don't know what I'm doing wrong here. When I get to the line that performs the MID function I get an error saying 'invalid procedure call or argument', I'm guessing this is because Location and Length show a value of '0' at that point. What am I doing wrong??? I really wanted to finish this program by Thursday cause I wanted to take Friday off to go to the St. Patty's Day Parade here in NY.. I've never been and was really looking forward to drinking LOTS of green beer =) Crazy thing is that this isn't even the hard part of the program and I'm already stuck... HELP!!
Here's all the code I've got
FRMtdmn (Main form) CODE:
Private Sub Command1_Click()
Dim strData As String
Dim intFile As Integer
Dim Location As Integer, Length As Integer
Dim PullFrom As String
intFile = FreeFile
Open "M:scbmainjbrower
econtactarray.tst" For Input As #intFile
Do Until EOF(intFile)
' Read a record
Input #1, strData
' Get position of data to pull from user
FrmFROM.Show vbModal
PullFrom = Mid(strData, Location, Length)
' MsgBox strData
Loop
Close #intFile
End Sub
FrmFROM (this is the form that looks like an input box with 3 text fields) CODE:
Public Sub cmdOKfrom_Click()
Location = txtfrom.Text
Length = txtLength.Text
DataTo = txtTo.Text
txtTo.Text = " "
txtfrom.Text = " "
txtLength.Text = " "
FrmFROM.Refresh
FrmFROM.Hide
End Sub
This is the second day I'm spending just trying to do this and I think I'm going to lose my mind - LOL. I know it's simple to do, and I've done it before, but for some reason it's just not working here. What the f@#k am I doing wrong?
THANKS SOO SOO SOO MUCH!!
Joni
Cannot Read Variable Values With Mouse
I recently reloaded my VB5 onto a new computer. Problem is I can
no longer read the variable values when examining the running code.
I used to just hover the cursor over the variable and the
current value would show up in a little box.
Any ideas on how to get VB to once again show the running values ?
Moving Variable Values Between Forms
In my form (frmBookmakerLogin.frm) i have a variable called strStoredLogin. I want to use that variable on a seperate form (frmBookmakerMain.frm) but im not sure how to move the variables between forms.
Can anybody help please?
Regards,
Robert Love.
Read Variable Values From A File
I'm pretty sure this has been addressed in the past, but I have not had luck finding specifically what I'm looking for. I have a program which deals with golfing stats. Part of it will tell you how far over par you are for each hole. Ordinarilly, that'd be fine, but I would like this program to work for more then one golf course. Part of my code is as follows:
Code:
Private Sub cmdCompute_Click()
Open "C:Documents and SettingsuserDesktopdataverdaegreens.txt" For Input As #1
If optf9 = True Then
totalf9 = Val(txtInput1) + (txtInput2) + (txtInput3) + (txtInput4) + (txtInput5) + (txtInput6) + (txtInput7) + (txtInput8) + (txtInput9)
picTotal.Print totalf9
overpar1 = Val(txtInput1) - Val(holep1)
overpar2 = Val(txtInput2) - Val(holep2)
overpar3 = Val(txtInput3) - Val(holep3)
overpar4 = Val(txtInput4) - Val(holep4)
overpar5 = Val(txtInput5) - Val(holep5)
overpar6 = Val(txtInput6) - Val(holep6)
overpar7 = Val(txtInput7) - Val(holep7)
overpar8 = Val(txtInput8) - Val(holep8)
overpar9 = Val(txtInput9) - Val(holep9)
totaloverparf9 = overpar1 + overpar2 + overpar3 + overpar4 + overpar5 + overpar6 + overpar7 + overpar8 + overpar9
I have a text file for the course, which is in the format:
Code:
"holep1", 4
"holep2", 3
"holep3", 4
, ecetra. I fell I'm missing something, as when I run the program, it never subtracts the pars (holep1, etc.) away from the txtInputs. I know I probably should have used arrays, but I am not familiar nor comfortable with them yet. I also appologize for posting so much code, but feel it was relevant towards my question. Thanks in advance.
Passing Variable Values In Forms ..
Hello..
Let suppose i am calling a form from Form2..
Form1.show
While the form load i can write
a = form1.combo1 *to get the value of combo1 field.
How i can call the value of a variable?...
Or how i can send a value of a variable from one form to another..?
Thanks..
anis
"Miles to Go Before I Sleep!!........."
Referencing Previous Variable Values
I'm a newbie to VB but have been using a different language for my programming. My other language allows you to access previous values for a variable by adding [x] after the variable name(ie. variablename[x]), where x represents how far back to access the value from. Is there anything similar in vb?
|