473,388 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

ParamArray Problem

mafaisal
142 100+
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 2313
kadghar
1,295 Expert 1GB
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 100+
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 Expert 1GB
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 100+
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 100+
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 100+
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 Expert 1GB
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 100+
This might help you

Importance of Call


--
Kenneth
"Better Than Yesterday"
Feb 12 '08 #9
kadghar
1,295 Expert 1GB
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 100+
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 100+
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 Expert 8TB
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 Expert 8TB
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 Expert 1GB
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...

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.