|
That's a nice coincidence, but it means nothing
Plus, OP knows how many bits he's using - if that was 64 and he uses int anyway it's entirely his own fault
|
|
|
|
|
Sorry harold, but on this one I have to disagree.
harold aptroot wrote: if that was 64 and he uses int anyway it's entirely his own fault
If he inherits other peoples code that does this, then it's not his fault.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
He'd be asking a different kind of question if he were
|
|
|
|
|
I was sitting watching a film with the family and it suddenly popped into my head! It's better dealt with now rather than later when his pointers turn out to be invalid and he has no clue why.
I've just knocked up a utility struct wrapping IntPtr with arithmetic/conversion operators built in for future use prompted by this to solve this problem the next time I need it. Not sure whether to post as a Tip or just as an answer to the OP...
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Why not do both? As tip + a link here?
If you'd just post it here, it would get buried in the avalanche of posts..
|
|
|
|
|
Done[^]
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Looks good, this will come in handy
|
|
|
|
|
I've just posted a small wrapper struct around IntPtr that might help!
Here it is[^].
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hi Sir,
I am a reading a character typed from combobox.
But for the first time,the value is getting empty
I am trying with this code :
void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
{
string str;
str = comboBox1.Text;
MessageBox.Show(str);
}
In VC++ i used this and got the text,
void CTest1View::OnEditchangeCombo1()
{
CString strTemp;
m_ctrlCombo.GetWindowText(strTemp;);
}
Am i in the right function??
Thanks
Raj
|
|
|
|
|
You need to set the index, by default the cbo value is set to -1 that's why you getting empty string.
Thanks
Md. Marufuzzaman
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Hi sir,
Thanks for your reply,
But where i have to set index,??
nnd what i have to set.??
Thanks
Raj
|
|
|
|
|
just set the cbo.selectedIndex = 1 (this will select the text of the index 1). You will decide which index you want to load / show first.
Thanks
Md. Marufuzzaman
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
thank you dear..
What rule is appropriate in the Sugeno method ?
|
|
|
|
|
I suggest you read this[^]. Then you can come up with your code and actually ask about specific problems.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
In his defence, I think he pressed the wrong button and posted it as a new message, rather than a reply - he subsequently posted it as a reply to a request for more information I made a week ago.
So not a lot of use either way, really!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Hi sir,
I am trying to edit in the ComboBox.
Every time the focus is setting to start position
For Example:
If i enter first character as "P"
then if i type the second character "a"
It is coming before "p" as "ap"
But i want it as "pa"
Any idea will be helpful.
Thanks
Raj
|
|
|
|
|
when you set focus on combobox ??
Are you setting focus on any key event ??
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
I guess RightToLeft property is set to true. Make it false and things would work as you want.
|
|
|
|
|
Pardon me if I'm a little vague - I know what I want to do, but I'm not certain it's possible.
I want to build a control that can be set at design time to use different data types. My first attempt, now that I look at it from a distance, is obviously not going to work. To wit:
public SByte DataValue
{
get { return SByte.Parse(this.Text); }
set { this.Text = value.ToString(); }
}
public Int16 DataValue
{
get { return Int16.Parse(this.Text); }
set { this.Text = value.ToString(); }
}
While it doesn't produce any syntax errors, it gives the compiler heartburn. I was thinking that I can have multiple methods of the same name but different types, but since the signature is the same for both methods, it creates ambiguity.
In the class declaration I've included an enum type and member to contain the types I want to be able to use this control with, and my thought was to make the type changeable at design time by changing the DataType property in the Designer, so that the same control could be used to collect different types of data. This would be set in the VS Designer as a Property of the control. The parent form for the control would be responsible for keeping track of which data type each instance of the control uses, but it would be freed from the task of converting inputs to the correct type and performing validation for each type, that being delegated to the control, itself.
My initial approach is clearly bogus, but I still think that it should be possible to do. My understanding of generic classes and methods is thin, but I suspect that I should be looking there for a solution. Can anyone suggest a smarter way to tackle this problem?
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
You do indeed want to use Generic classes (have a look here[^]
But basically:
namespace Tester
{
class Program
{
static void Main(string[] args)
{
MyClass<int> mi = new MyClass<int>();
MyClass<int> mi2 = new MyClass<int>(123);
MyClass<string> ms = new MyClass<string>("Hello");
}
}
public class MyClass<T>
{
private T dataValue;
public T DataValue
{
get { return dataValue; }
set { dataValue = value; }
}
public MyClass()
{
}
public MyClass(T x)
{
dataValue = x;
}
}
}
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
That makes things a lot clearer than the books I've been reading. Thanks!
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
There are two ways to handle this. The traditional way is to have a field dataValue that is of type object and a property to match
public class Test
{
private object dataValue;
public object DataValue
{
get { return dataValue; }
set { dataValue = value; }
}
}
Alternatively you can use a generic class in the same way
public class Test<T>
{
private T dataValue;
public T DataValue
{
get { return dataValue; }
set { dataValue = value; }
}
}
Generics don't play nice with the designer though as there is no way to set the type of T which is why you don't get generic controls or componenets so the first method is the most commonly used.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
I can see how generics would make the designer crazy, but I may try anyway just to see what happens. The object method would add a tiny bit of extra work in the parent form, I think, extracting the value to assign it to something, but would still be better than rewriting a bunch of redundant code. Thanks!
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hi All,
Suppose each element of a one-dimensional array is a single text character, how can I put all of them together to create a single number? I know that one must convert them into characters of type Int or Double, but what about the comma and the period? For instance if the first element of the array is the text character 9, the second is a comma, the third is the text character 11, and the fourth is the text character 8. How can I put them together to form the number 9,118? Thanks in advance for your reply.
|
|
|
|
|