By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,763 Members | 1,400 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,763 IT Pros & Developers. It's quick & easy.

properties

P: n/a
Hope I word this ok. Ive created a class, which I added to my
references. In the class ther is public method called isloggedin.
when I check the objects I see 'public bool IsLoggedIn { get; }
Member of BetBetter.Betfair.BetfairWrapper'. My project compiles
fine, runs ok, as Im not requesting anything. What Id like to know is
how do I get response from 'Isloggedin' into a textbox. So far I get an
error that cannot convert type bool to system.windows.form. Am I
correct in thinking this is possible because its public.
Regads Robert

May 11 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Robert,

Well, you can set it manually, by setting the Text property to the value
for true or false (depending on the property value).

You can also use a data binding on the textbox, like so:

// Assume textBox is the textbox, and myInstance is your class.
textBox.Bindings.Add("Text", myInstance, "IsLoggedIn");

Basically, the first parameter specifies the property on the control you
want bound to the object. The second property is the data source, in this
case, your object instance. The third property is the property to bind to
on your instance.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Ro********@yahoo.co.uk> wrote in message
news:11********************@u72g2000cwu.googlegrou ps.com...
Hope I word this ok. Ive created a class, which I added to my
references. In the class ther is public method called isloggedin.
when I check the objects I see 'public bool IsLoggedIn { get; }
Member of BetBetter.Betfair.BetfairWrapper'. My project compiles
fine, runs ok, as Im not requesting anything. What Id like to know is
how do I get response from 'Isloggedin' into a textbox. So far I get an
error that cannot convert type bool to system.windows.form. Am I
correct in thinking this is possible because its public.
Regads Robert

May 11 '06 #2

P: n/a
Hi, thankyou for your reply. I tried your suggestion and get an
Error 1 'System.Windows.Forms.TextBox' does not contain a definition
for 'Bindings'.
regards robert

May 11 '06 #3

P: n/a
V
Hi Robert,

Which version of the framework are you using? I am not too sure whether
the binding property is available in 1.1

Also, you could simply call the ToString() method on your Property and
assign that to the TextBox.Text property.

Regards,
Vaibhav

May 11 '06 #4

P: n/a
Thankyou for your reply. Im using vs2005 and i can access the
databindings in the textbox properties. Ive tried tostring but get
another error Error 1 Cannot convert method group 'ToString' to
non-delegate type 'string'. Did you intend to invoke the method?. Im at
a loss here.
Regards Robert

May 11 '06 #5

P: n/a

<Ro********@yahoo.co.uk> wrote...
Thankyou for your reply. Im using vs2005 and i can access the
databindings in the textbox properties. Ive tried tostring but get
another error Error 1 Cannot convert method group 'ToString' to
non-delegate type 'string'. Did you intend to invoke the method?. Im at
a loss here.


I believe that's the message you get when you try to invoke ToString() as a
property instead of as a method.

Could you have forgotten the parenthesis on ToString() ?

/// Bjorn A
May 11 '06 #6

P: n/a
Im now trying textBox1 = bf.IsLoggedIn.ToString(); and get
Error 1 Cannot implicitly convert type 'string' to
'System.Windows.Forms.TextBox'
Regards Robert

May 12 '06 #7

P: n/a
Man, go read some book, this is ridiculous, you have been solving this issue
for 2 days...

this.textBox1.Text = bf.IsLoggedIn.ToString();

and don't tell us that textBox1 does not exist in current context because
you renamed it yesterday.

<Ro********@yahoo.co.uk> wrote in message
news:11*********************@y43g2000cwc.googlegro ups.com...
Im now trying textBox1 = bf.IsLoggedIn.ToString(); and get
Error 1 Cannot implicitly convert type 'string' to
'System.Windows.Forms.TextBox'
Regards Robert

May 12 '06 #8

P: n/a
And youve solved it in Seconds. You right, I will go read some books.
Jumped in to far on this. Thanks for your reply and thanks to you all.
Regards Robert

May 12 '06 #9

P: n/a
You have to assign it to the .Text property, not to the TextBox itself:

textBox1.Text = bf.IsLoggedIn.ToString();

May 12 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.