From: Anita on 28 Feb 2010 11:31 "duke" <nospama(a)3web.net> wrote in message news:7eb97e81-1bc7-462e-abe6-9af7794b111b(a)15g2000yqa.googlegroups.com... On Feb 28, 8:16 am, "Henning" <computer_h...(a)coldmail.com> wrote: > "Anita" <no_s...(a)mail.com> skrev i > meddelandetnews:dxvin.58165$G_2.40207(a)newsfe15.iad... > > > I'm trying to use a simple function, and pass two integer values to it. > > > Function Readb(intDev as Integer, intBank As Integer) > > Do something > > End Function > > > Using Readb 2,0 works fine, but > > Using Readb txtBank.text results in an 'Argument not optional' error > > message. > > in the text box is 2,0 or 2, 0 - either one, Argument not optional. > > > What am I missing? > > > Any suggestions appreciated. > > Use Val(txtBank.text) or Cint(txtBank.text). > > A TextBox Value is String, the Function expects an Integer. > > /Henning You are missing the word "Optional" for each time you have an optional input in the Function. It should read: Function Readb(intDev as Integer, Optional intBank As Integer) Have a Good Day Duke: If I use Optional, will my input be allowed by the function without the second value? I must use both values to select a correct hardware device. I'm checking for "" values also. Does that Optional mean not necessary?
From: Bob Butler on 28 Feb 2010 11:28 "Anita" <no_spam(a)mail.com> wrote in message news:HEwin.52388$0N3.23917(a)newsfe09.iad... > This came to this simple test, but my final code will pull these two > values from a database as the code runs. > Like: 1,0 1,1 2,0 2,1,...6,0, etc. You'll be querying for a single field that contains two values? That's and odd (and IMO poor) design > Possibly like: > x=instr(1,txtBank.Text,",") <-- not sure how to handle > > readb cint(left$(RS!Dev,x-1)),Cint(mid$(RS!Bank.Text,x+1)) <-- Sort of > like this I'd avoid the ! syntax since it doesn't work well if you need to use numeric or variable field names (that's beside the point) You can use something like RS.Fields("Dev").Value instead of txtBank.Text
From: Anita on 28 Feb 2010 12:02 "Bob Butler" <noway(a)nospam.ever> wrote in message news:%23hB6ONJuKHA.4636(a)TK2MSFTNGP06.phx.gbl... > > "Anita" <no_spam(a)mail.com> wrote in message > news:HEwin.52388$0N3.23917(a)newsfe09.iad... >> This came to this simple test, but my final code will pull these two >> values from a database as the code runs. >> Like: 1,0 1,1 2,0 2,1,...6,0, etc. > > You'll be querying for a single field that contains two values? That's > and odd (and IMO poor) design > > > >> Possibly like: >> x=instr(1,txtBank.Text,",") <-- not sure how to handle >> >> readb cint(left$(RS!Dev,x-1)),Cint(mid$(RS!Bank.Text,x+1)) <-- Sort of >> like this > > I'd avoid the ! syntax since it doesn't work well if you need to use > numeric or variable field names (that's beside the point) > > You can use something like RS.Fields("Dev").Value instead of txtBank.Text > You have been a great help Bob. No, data my fields each have one value.
From: duke on 28 Feb 2010 12:00 On Feb 28, 9:31 am, "Anita" <no_s...(a)mail.com> wrote: > "duke" <nosp...(a)3web.net> wrote in message > > news:7eb97e81-1bc7-462e-abe6-9af7794b111b(a)15g2000yqa.googlegroups.com... > On Feb 28, 8:16 am, "Henning" <computer_h...(a)coldmail.com> wrote: > > > > > "Anita" <no_s...(a)mail.com> skrev i > > meddelandetnews:dxvin.58165$G_2.40207(a)newsfe15.iad... > > > > I'm trying to use a simple function, and pass two integer values to it. > > > > Function Readb(intDev as Integer, intBank As Integer) > > > Do something > > > End Function > > > > Using Readb 2,0 works fine, but > > > Using Readb txtBank.text results in an 'Argument not optional' error > > > message. > > > in the text box is 2,0 or 2, 0 - either one, Argument not optional. > > > > What am I missing? > > > > Any suggestions appreciated. > > > Use Val(txtBank.text) or Cint(txtBank.text). > > > A TextBox Value is String, the Function expects an Integer. > > > /Henning > > You are missing the word "Optional" for each time you have an > optional input in the Function. > > It should read: > > Function Readb(intDev as Integer, Optional intBank As Integer) > > Have a Good Day > > Duke: > > If I use Optional, will my input be allowed by the function without the > second value? > I must use both values to select a correct hardware device. I'm checking for > "" values also. > Does that Optional mean not necessary? The word "Optional" means that the function will NOT give you the message 'Argument not optional' and will proceed without generating an error condition. If your program in fact does require that these fields NOT be blank, then you would still have to check for that situation. Hope that clears it up!
First
|
Prev
|
Pages: 1 2 3 Prev: Is there a way to convert a .TIF file in VB6 Next: trouble with Winsock control.... |