473,499 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ParamArray Problem

mafaisal
142 New Member
Hello Experts

See My Code

Expand|Select|Wrap|Line Numbers
  1. Private sub F_Clear(Paramarray Cntr())
  2. dim i%
  3. For i=0 to ubound(cntr)
  4.   cntr(i).text = ""
  5. next
  6. End sub
In this procedure when I call this error is coming
Any Bugs in the code
Error is

F_Clear (TxtBox(0),TxtBox(2))
Compile Error
Expected: =
Feb 12 '08 #1
14 2316
kadghar
1,295 Recognized Expert Top Contributor
Hello Experts

See My Code

Private sub F_Clear(Paramarray Cntr())
dim i%
For i=0 to ubound(cntr)
cntr(i).text = ""
next
End sub


F_Clear (TxtBox(0),TxtBox(2))
Compile Error
Expected: =
I dont know what the problem might be. I tried it using two textboxes, and it cleared them without any problem. May be your textboxes have some issues.

btw, i liked your avatar.

HTH
Feb 12 '08 #2
mafaisal
142 New Member
Hello Kadghar
Thanx For Reply
Hw u try
Plz Give me
textboxe have wat pblm occure, if it is one then no prob

also Give u r trying code

I will

Faisal

I dont know what the problem might be. I tried it using two textboxes, and it cleared them without any problem. May be your textboxes have some issues.

btw, i liked your avatar.

HTH
Feb 12 '08 #3
kadghar
1,295 Recognized Expert Top Contributor
Hello Kadghar
Thanx For Reply
Hw u try
Plz Give me
textboxe have wat pblm occure, if it is one then no prob

also Give u r trying code

I will

Faisal
i created a new form with two textboxes : textbox1 and textbox2, then i copy pasted your sub, and in the click event of the form i called it:

Expand|Select|Wrap|Line Numbers
  1. Private Sub F_Clear(ParamArray Cntr())
  2. Dim i%
  3. For i = 0 To UBound(Cntr)
  4. Cntr(i).Text = ""
  5. Next
  6. End Sub
  7.  
  8. Private Sub UserForm_Click()
  9. Call F_Clear(TextBox1, TextBox2)
  10. End Sub
then i run it, write something in each textbox and when i click on the form it clears both textboxes.

HTH
Feb 12 '08 #4
mafaisal
142 New Member
Hello Kadghar

Thanx For

It is wat is Usage of Using call Before Procedure

I mean
Call F_Clear(textbox1)

i just Call as
F_Clear(textbox1)

When use call Bfore that it working

Reply if u can

Faisal

i created a new form with two textboxes : textbox1 and textbox2, then i copy pasted your sub, and in the click event of the form i called it:

Expand|Select|Wrap|Line Numbers
  1. Private Sub F_Clear(ParamArray Cntr())
  2. Dim i%
  3. For i = 0 To UBound(Cntr)
  4. Cntr(i).Text = ""
  5. Next
  6. End Sub
  7.  
  8. Private Sub UserForm_Click()
  9. Call F_Clear(TextBox1, TextBox2)
  10. End Sub
then i run it, write something in each textbox and when i click on the form it clears both textboxes.

HTH
Feb 12 '08 #5
werks
220 New Member
Hi guy'z the only thing differ between kadghar codes and mafaisal codes is that

kadghar
Expand|Select|Wrap|Line Numbers
  1. Call F_Clear(TextBox1, TextBox2)
mfaisal
Expand|Select|Wrap|Line Numbers
  1. F_Clear (TxtBox(0),TxtBox(2))

--
Kenneth
"Better Than Yesterday"
Feb 12 '08 #6
mafaisal
142 New Member
Hello

Yes I Know, When Use Call that work
My Question is Wat is the importants of Using Call...?

Faisal

Hi guy'z the only thing differ between kadghar codes and mafaisal codes is that

kadghar
Expand|Select|Wrap|Line Numbers
  1. Call F_Clear(TextBox1, TextBox2)
mfaisal
Expand|Select|Wrap|Line Numbers
  1. F_Clear (TxtBox(0),TxtBox(2))

--
Kenneth
"Better Than Yesterday"
Feb 12 '08 #7
kadghar
1,295 Recognized Expert Top Contributor
Hello

Yes I Know, When Use Call that work
My Question is Wat is the importants of Using Call...?

Faisal
I dont know. I thought it was the same using it or not.
I have that "bad habit" of using it, but... seems that it solved the problem this time.

There was a short discussion in this forum about using Call a few weeks ago, i'll see if i find it to ask why this is happening to some Expert...

Ô_o (wait... )
Feb 12 '08 #8
werks
220 New Member
This might help you

Importance of Call


--
Kenneth
"Better Than Yesterday"
Feb 12 '08 #9
kadghar
1,295 Recognized Expert Top Contributor
This might help you

Importance of Call


--
Kenneth
"Better Than Yesterday"
I see... but they say you can use it for calling functions if you dont care about the return value. but... this is not a function!!!!

=( this time i have no idea why this is happening, i'll google some similar situations.
Feb 12 '08 #10
mafaisal
142 New Member
K, Thanx
So It Concluded That
Using of Call is Good Practice
Usually i did not use Call
K

Faisal

This might help you

Importance of Call


--
Kenneth
"Better Than Yesterday"
Feb 12 '08 #11
werks
220 New Member
K, Thanx
So It Concluded That
Using of Call is Good Practice
Usually i did not use Call
K

Faisal
Yes! it is easier to identify codes.. you should start practicing it
Feb 12 '08 #12
Killer42
8,435 Recognized Expert Expert
I've never used a ParamArray, so this might be incorrect. But my immediate response is that instead of
F_Clear (TxtBox(0),TxtBox(2))
you should try
F_Clear TxtBox(0), TxtBox(2)
Feb 12 '08 #13
Killer42
8,435 Recognized Expert Expert
Yes! it is easier to identify codes.. you should start practicing it
Absolute rubbish! With the possible exception of a ParamArray (don't know yet) there's no reason to use Call.

EDIT: No, I've tried it, and the ParamArray has no effect. You don't need the Call either way. Just leave off the extra parentheses.
Feb 12 '08 #14
kadghar
1,295 Recognized Expert Top Contributor
I've never used a ParamArray, so this might be incorrect. But my immediate response is that instead of
F_Clear (TxtBox(0),TxtBox(2))
you should try
F_Clear TxtBox(0), TxtBox(2)

Not incorrect at all, it worked great.
Feb 12 '08 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1696
by: Tom | last post by:
Hi everyone In VB6,paramarray parameter is passed using byref,but in VB.NET,using byval.How can I get back the changed value of the paramarray parameter My work case in vb.net like this...
0
1415
by: Cort | last post by:
I have a project that I am trying to upgrade that uses VB6 components and ASP. I have gotten to the point when I have been able to upgrade the project to VB.NET, compile and register it for use by...
2
9568
by: Edlueze | last post by:
Greetings: I have two functions and I would like to pass the ParamArray gathered from one function to the other function. For the purposes of this post, let's say that they are calculating...
2
3083
by: Bruno Miousse | last post by:
I am trying to invoke a COM component (written in VB6) which accepts parameter of ParamArray data type. What would be the proper syntax in C# for passing ParamArray in VB6? Thanks.
8
9245
by: Tubs | last post by:
I know it might seem weird but i have a need to pass the contents of a paramarray from one sub to another that also takes a paramarray. Problem is i want to pass it exactly as it came in to the...
6
3464
by: Peter | last post by:
Hi everyone In VB6,paramarray parameter is passed using byref,but in VB.NET,using byval.How can I get back the changed value of the paramarray parameter My work case in vb.net like this...
0
1030
by: djpirra | last post by:
Hi, I managed to create a Shared Add-in in Vs.net 2003 and create all the menus, UDFS and all that.... The only 2 problems i am having now are: 1 - The formulas seems to work only at second...
0
22990
ADezii
by: ADezii | last post by:
Generally, the number of Arguments in a Procedure Call must be the same as in the Procedure Specification. If a Procedure requires 3 Arguments in its Specification, when calling the Procedure you...
3
2976
mafaisal
by: mafaisal | last post by:
End of parameter list expected. Cannot define parameters after a paramarray parameter. Public Sub F_Bind(ByVal StrSql As String, ByVal ParamArray Ctrls() As Object,Optional ByVal Row as Integer...
0
7130
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5468
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
295
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.