|
Will the MouseHover event suffice?
|
|
|
|
|
I'm not sure what you mean. I may use MouseHover to trigger when to show the tooltip, but I'm looking for how to display a usercontrol as a tooltip.
|
|
|
|
|
|
Yeah, I have. I'm looking for something I can add to my C# project, so either C# of VB.NET (I could translate it from VB fairly well, or use VS's converter).
|
|
|
|
|
Any other ideas? Could really use something simple.
|
|
|
|
|
While I haven't found what I was looking for, I did find another solution.
I had thought that the built-in System.Windows.Forms.Tooltip class handled text only... And basically that's true. But I just noticed (Thanks PNelson!) that it's got OwnerDraw functionality, so I'll just draw it myself.
|
|
|
|
|
txtInterestRate.Text.ToString = 12;
What am I doing wrong???
Im currently a student, trying to complete a task...and im stuck!
The code is currently under a method in my application.
Help Please
Im trying to set the InterestRate textbox value to 12.
|
|
|
|
|
OlieColie wrote: txtInterestRate.Text.ToString = 12;
What am I doing wrong???
Well, Text already returns a string , so there is no point in asking it to make a string from something that already is a string . It would be pointless.
You want to make the number a string, so perhaps you might want to write 12.ToString() , but if you are dealing with literal values, why not just say "12" and be done with it.
|
|
|
|
|
You have asked this at least three times across at least two forums. Please ask once in the right forum, and leave it at that.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Indeed, only post once.
Just to clarify, ToString() is a function that returns the value of an object, as a string, and it can't be set.
The TextBox.Text property is all you need, it is the text of the text box, so you can either do
txtInterestRate.Text = 12.ToString();
or simply
txtInterestRate.Text = "12";
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
My favorite word is still Callipygian.
|
|
|
|
|
Hi - I mean no disrespect to you in this post.
1 - you are a student, so I assume you are being 'taught'.
2 - the first chapter in most, if not all, C# beginner book handles strings, usually in the form string.Format("{0}" , 12) and, like the previous answers, obj.ToString() .
3 - are you paying for your course, and at what institution?
4 - Do you have any C# books?
I can't believe, in all honesty, that a C# student, would not have been taught how to convert a number to a string.
Seriously, how much are you actually taught, and how much are you left to figure out on your own, and are you given any learning material, or even any pointers on how to find out his info for yourself?
Vote me down if you want, but this is not meant as abuse - just pure curiousity at what is being taught.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
txtInterestRate.Text="12";
try this
|
|
|
|
|
How do I set a textbox value to 12.
I tried the ToString method, but it did not work.
|
|
|
|
|
value? you probably mean TextBox.Text which holds a string; if you want to convert
that to some other type, you probably need a Parse or better yet TryParse method
(see int, double, DateTime... classes).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
|
hi
please help me I want to inset new rows in the DataGrid in C# in developing SmartDeviceApplications using visualstudio.net2005 to develop an application but i until this time cann't insert new rows into the datagrid nevertheless i can select data from tables into the datagrid but I cann't edit or add new row into this datagrid pleaaaaaaaaaaaaaaaaaaaaaaaaaaaaase help me.
|
|
|
|
|
Hi all,
I'm a new programmer and I've come across a problem that I'll need some help in.
class MyObject1{...}
class MyObject2{...}
class MyObject3{...}
class MyObject4{...}
public void test(object a){
Type a = a.GetType();
//Now what?!
}
//Somewhere in main...I call test and pass it an instance of one of these objects...
test(new MyObject1());
test(new MyObject4());
test(new MyObject3());
test(new MyObject2());
What I'd like to know is how to convert variable 'a' into whatever object was passed into test();
This is probably a silly question but I'm learning....
Thanks in advance.
Humble.
|
|
|
|
|
Try to write a more useful subject line, that says something about your question. We're in the C# forum, so mentioning that in the subject is quite superflous. Almost everyone that starts a thread here need help, so that doesn't do anything at all to distinguish your thread from others.
To get a reference of a specific type, just cast the object reference:
if (a is MyObject1) {
MyObject1 a1 = (MyObject1)a;
}
or:
MyObject1 a1 = a as MyObject1;
if (a1 != null) {
}
As the reference has to be the exact type, there is no solution that handles any type. You have to write code to handle each type separately.
If the classes are supposed to work in a similar way, you might want to create a base class or an interface that defines some common methods, and make all the classes inherit the base class or interface. That way you can use a reference to the base class or the interface instead of a reference to the common base class Object .
---
single minded; short sighted; long gone;
|
|
|
|
|
Just to add - the difference between (MyObject)a and a as MyObject is that the first throws an exception and the second returns null if the cast is invalid.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I tried to use 'as' today and the compiler slapped me in the face (ie. it told me i was wrong)
It was just like this:
class something
{
//some private variables and whatnot
}
static void Main(string[] args)
{
object test = new something();
something newSomething = test as something;
}
and shwam, compiler throws som error.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
what was the error ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I forget, i was using some microsoft visual express thingymajig, rather than my preferred SharpDevelop. I either spelled something wrong and couldn't see it, or the compiler was having a bad day.
Its working fine now (in #Develop)
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
That code compiles just fine. What does the code look like that you are actually using, and what error message do you get?
---
single minded; short sighted; long gone;
|
|
|
|
|
I have the following regular expression almost working...
Regex myRegex = new Regex(
"(?<=<(?<tagName>\\S+)\\s+className=\"LiteralClassName.*?>\\s*)\\S.*?\\S(?=\\s*</\\k<tagName>>)", RegexOptions.Singleline);
Basically, I don't know the tag name, so I am using a match class to capture any tag that has an attribute "className" whose value begins with "LiteralClassName". Essentially, this regex is getting the innerXml property for all matching tags of this sort. One of the problems that I am having is that if the tag name is, say "Item", and another tag of type "Item" exists within the inner xml of what I am trying to capture, then I get f'ed. Is there some way to specify that there are an equal number of "<[^/]" and "</" between my tagName class (ie, to ensure that the number of start tags and end tags are equal)? Thanks,
Jeff
|
|
|
|