cannot convert from 'string' to 'ref string'

G

Guest

I have an activeX dll, I am calling one function from that
dll. I am using C# as coding language. I am getting
following error.
cannot convert from 'string' to 'ref string'
How do I call this function ?.

My statement is like this
CustomOutVal = CustObj.Authenticate(txtUserName.Text,
pass , Domain );

Regards,
Kishor
 
G

Guest

Which of the parameters is supposed to be passed by ref?? If it is the first
parameter (txtUserName.Text) then you will need to create another string
variable, set it = to txtUserName.text and pass that into the call. The
reason for this is that properties cannot be used as reference parameters..

To top this off, when calling a method that has a ref parameter, specify the
ref keyword..

an example would be (if the first parameter is the ref parameter):
string tempUserName = txtUserName.Text;
CustomOutVal = CustObj.Authenticate(ref tmpUserName,
pass , Domain );

Hope this helps

Eddie de Bear
 
G

Guest

Thanks,
problem solved

Kishor

Eddie de Bear said:
Which of the parameters is supposed to be passed by ref?? If it is the first
parameter (txtUserName.Text) then you will need to create another string
variable, set it = to txtUserName.text and pass that into the call. The
reason for this is that properties cannot be used as reference parameters..

To top this off, when calling a method that has a ref parameter, specify the
ref keyword..

an example would be (if the first parameter is the ref parameter):
string tempUserName = txtUserName.Text;
CustomOutVal = CustObj.Authenticate(ref tmpUserName,
pass , Domain );

Hope this helps

Eddie de Bear
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top