Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Hta how acces many text box in vbscript

Reply
 
Old 12-08-2008   #1 (permalink)
Pat


 
 

Hta how acces many text box in vbscript

Hi,

I got an hta with a lot of text box. How can I access the information of the
text box in vbscript without calling them by their name?
All the example I found use the method var = inputObjectName.value
But I can’t, I have a table of 15 rows with 3 text box by row!

I would like to use a loop to create the name of the input fields. Let’s
built an example:

<script language="VBScript">
Sub run
[…]
for i=1 to 5
strA = ("A"&i).value
strB = (“B"&i).value
strC = ("C"&i).value
strLine = strA.value & "*" & strB.value & "*" & strC.value
msgbox strLine
Next
[…]
End Sub
</script>

<script language="VBScript">
[…]
<tr>
<td><input type="text" name="A1" size="100"></td>
<td><input type="text" name="B1" size="8"></td>
<td><input type="text" name="C1" size="8"></td>
</tr>
<tr>
<td><input type="text" name="A2" size="100"></td>
<td><input type="text" name="B2" size="8"></td>
<td><input type="text" name="C3" size="8"></td>
</tr>
[…]
<p><input type="button" value="Run" name="run" onClick="run" class="save"></p>
[…]
</body>

I try many solution but my proble is around this line; strC = ("C"&i).value
It fail cause ("C"&i) is not an object. How can I fix that.

Any suggestion would be welcome





My System SpecsSystem Spec
Old 12-08-2008   #2 (permalink)
Tom Lavedas


 
 

Re: Hta how acces many text box in vbscript

On Dec 8, 2:19*pm, Pat <P...@xxxxxx> wrote:
Quote:

> Hi,
>
> I got an hta with a lot of text box. How can I access the information of the
> text box in vbscript without calling them by their name?
> All the example I found use the method var = inputObjectName.value
> But I can’t, I have a table of 15 rows with 3 text box by row!
>
> I would like to use a loop to create the name of the input fields. Let’s
> built an example: *
>
> <script language="VBScript">
> Sub run
> *[…]
> * *for i=1 to 5
> * * * strA = ("A"&i).value
> * * * strB = (“B"&i).value
> * * * strC = ("C"&i).value
> * * * strLine = *strA.value & "*" & strB.value & "*" & strC.value
> * * * msgbox strLine
> * *Next
> […]
> End Sub
> </script>
>
> <script language="VBScript">
> * * […]
> <tr>
> * *<td><input type="text" name="A1" size="100"></td>
> * *<td><input type="text" name="B1" size="8"></td>
> * *<td><input type="text" name="C1" size="8"></td>
> </tr>
> <tr>
> * *<td><input type="text" name="A2" size="100"></td>
> * *<td><input type="text" name="B2" size="8"></td>
> * *<td><input type="text" name="C3" size="8"></td>
> </tr>
> […]
> <p><input type="button" value="Run" name="run" onClick="run" class="save"></p>
> […]
> </body>
>
> I try many solution but my proble is around this line; *strC = ("C"&i).value
> It fail cause ("C"&i) is not an object. How can I fix that.
>
> Any suggestion would be welcome
Try ...

for i=1 to 5
strA = Eval("A" & i & ".value")
strB = Eval("B" & i & ".value")
strC = Eval("C" & i & ".value")
strLine = strA & "*" & strB & "*" & strC
msgbox strLine
next

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
My System SpecsSystem Spec
Old 12-08-2008   #3 (permalink)
mayayana


 
 

Re: Hta how acces many text box in vbscript

You can use an index:

<td><input type="text" ID="A" size="100"></td>
<td><input type="text" ID="B" size="8"></td>
<td><input type="text" ID="C" size="8"></td>
<td><input type="text" ID="A" size="100"></td>
<td><input type="text" ID="B" size="8"></td>
<td><input type="text" ID="C" size="8"></td>
<td><input type="text" ID="A" size="100"></td>
<td><input type="text" ID="B" size="8"></td>
<td><input type="text" ID="C" size="8"></td>

'-- return the content of all textboxes with ID of "A".

strline = a(0).value & A(1).value & A92).value



My System SpecsSystem Spec
Old 12-22-2008   #4 (permalink)
Pat


 
 

Re: Hta how acces many text box in vbscript


Hi mayayana,

I don't try it for this hta but I keep it in mind for my next script.
Thanks for your answer.
Quote:

> strline = A(0).value & A(1).value & A(92).value
Pat
My System SpecsSystem Spec
Old 12-22-2008   #5 (permalink)
Pat


 
 

Re: Hta how acces many text box in vbscript

Nice I try it for fun.
It work, very interesting, first time I saw it this way!

Pat
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Acces right with WMI Method PowerShell
How to remove vbscript text from message box VB Script
Past vbscript input box text to the end of url VB Script
How to do No hang up VBScript (nohup for VBScript) VB Script
Cannot acces Vista from XP Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46