|
Furty,
thanks for the reply... this doesn't seem to be the case for me... the "code page" as you call it, contains only the form class definition, and everything is generated by Windows... the subclased treeview class lives in a different sourcefile, and is only referred to when I instantiate a new treeview item in the form class...
any more suggestions are welcome
|
|
|
|
|
ever figure this one out? im getting the same issue with an imagelist for a toolbar.. dont the problem until i add an image to the imagelist.. exact same error..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Look at the reply from "furty" above, this was my problem... I had declared something before the windows generated class, and the problem went away when I moved it further down in the source file...
hope this helps...
|
|
|
|
|
i ended up just making another form and using it.. as for saying you 'had declared something before..' do you mean where you declare your variables at the top of the class (where it generates all the textbox variables, etc.) or do you mean in the initializecomponent() section?
thanks! hopefully i wont run into this problem again..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
yes, I had added some declarations between the namespace declaration and the windows-generated form class declaration... once I moved those out, the problem went away...
|
|
|
|
|
double x, y, z;<br />
x = 41.3;<br />
y = 41.2;<br />
z = x - y;
If I perform the above operations, z should equal 0.1. Right??
But NO... .NET says that 41.3 - 41.2 = 0.099999999999994316.
Am I just being too demanding expecting to be able to get a precision in the first decimal place?? Or am I missing something?
-Michael Bray
mbray@ctiusa.com
|
|
|
|
|
Math.Round
Math.Round(3.44, 1); //Returns 3.4.
Math.Round(3.45, 1); //Returns 3.4.
Math.Round(3.46, 1); //Returns 3.5.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
OK, but tell me why I should have to do this?? What if I don't know the precision to expect, such as in the code that follows... What could I possibly put in the GetDifference(...) function that would know what level of rounding to perform? I'd have to iterate over several different rouding precisions, and that is just stupid.
<br />
public double GetDifference(double x, double y)<br />
{<br />
return x - y;<br />
}<br />
<br />
GetDifference(41.3, 41.2);<br />
GetDifference(41.33, 41.32);<br />
GetDifference(41.333, 41.332);<br />
-Michael Bray
mbray@ctiusa.com
|
|
|
|
|
fuzzylintman wrote:
OK, but tell me why I should have to do this??
Because double is much less accurate than a decimal. Have you tried using decimals instead? Is this monetary? Use a lower denominator (e.g. in penny value). There was a long discussion on this a few days back.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
|
Hi, all:
I have a simple WinForm application. I added a HelpProvider control to the form and I can provide Help to individual controls and form. I can not figure out how to call the TableofContents from a menuItem ( say &Content ) under main Menu Help. ( the old MFC way ). What should I do inside the menu item event handler? Thanks in advance.
Dion
|
|
|
|
|
Hi,
try using the Help class in your menuItem handler
Help.ShowHelp(parent,_helpfile.FullName);
where parent is the parent control or form, and _helpfile.FullName is the path and file name of your chm file.
Also note that the folliwng works to navigate to a specific help topic, incase you want to do this..
Help.ShowHelp(parent,_helpfile.FullName,key);
where key is a string.
To determain the key for a topic in your help file:
1)open your help file and goto the topic you want the key for.
2)right click in the topic(MainWindow, not the contents tree) and select properties.
3)in the properties window you will see an address like the following:
mk:@MSITStore:C:\Documents%20and%20Settings\Amber\Desktop\ShuttleThermalFix\ShuttleThermalFixHelp.chm::/ThermalTransfer/ReEntry/HOWTO.htm
Your KEY is everthing after ".chm::/"
so the following method call will launch help to the above topic:
Help.ShowHelp(parent,_helpfile.FullName,"ThermalTransfer/ReEntry/HOWTO.htm"
);
Hope this helps.
Amber Star
|
|
|
|
|
Hi!
Please help me! I hava a problem.
How I can check Keyboard buffer is empty or not?
For instance
do
{
// do something
} while (CharFromKeyBoard != "q");
System.Read and SystemReadLine waiting user input, but I need do some operation until user press some key, for instance char "q".
Sorry my English.
|
|
|
|
|
Try something like this (especially StreamReader.Peek() ):
StreamReader reader = new StreamReader(Console.In);
try
{
reader = new StreamReader(Console.In);
do
{
} while (reader.Peek() != 113);
}
finally
{
if (reader != null)
reader.Close();
}
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
This sample doesn't work.
The best overloaded method match for 'System.IO.StreamReader.StreamReader(System.IO.Stream)' has some invalid arguments
Argument '1': cannot convert from 'System.IO.TextReader' to 'System.IO.Stream'
|
|
|
|
|
That exception message is self-explanitory - you should be able to figure that one out. I just threw this sample together quick, but you have to learn to research problems yourself or you're really in trouble. If Console.In is a TextReader , then take a look at its methods or StreamReader 's constructors. The former yields that TextReader.Peek does exist so you don't even have to create a new class instance. Just use Console.In.Peek to look at the next character in the buffer.
Researching the docs is at least half of what development is.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
I know this is some years late but you might still be interested.
do
{
} while(!Console.KeyAvailable)
or
do
{
} while(!Console.KeyAvailable && Console.ReadKey().KeyChar == 'q')
Thats the sound of Inevitability ....
|
|
|
|
|
Hi,
I have a custom control that contains a list box. How can I make the control modal, so that once it is made visible, the application stands by e.g. until the user click on the listbox.
Thanks for your comments,
Yann
|
|
|
|
|
Only a form can be modal, so you'd have to display the control in a popup window or something. MSDN has a lot of documentation about this.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
I want make a HTML Designer with DHTML Editor Control in C# Language.The control 'dhtmled.ocx' relies in 'C:\Program Files\Common Files\Microsoft Shared\Triedit'.Like Microsoft Visual Studio Net Web Form Designer,I need show grid to snap the html UIElement.And I have known I should place the Editor control in a Windows Form. I named the form 'FormHTMLEditor'.I implemented the 'IHTMLEditHost' interfaces and it's method 'SnapRect'.But I didn't konw how to tell the Editor Control the service that provided by 'IHTMLEditHost'.
If I should implement the three interface:IHtmlPainter,IElementBehavior,IElementBehaviorFactory
Who can show me how to implement the solution!
3ks a lot!
gxuqin
gxuqin@cdthinker.com
|
|
|
|
|
i need to use a foreach statement on each item in my listbox so i can encrypt that item...then remove it..and move on to the next item. my question is how can i get all the items in my list box and create a string array with those items then i could use a foreach statement on it.
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
Like this:
string[] s = new string[listBox.Items.Count];<br />
listBox.Items.CopyTo(s,0);
|
|
|
|
|
im gonna go try it...but it looks like it will work...thanks alot for your help....
Jesse M
|
|
|
|
|
Well of course it will work.
|
|
|
|
|
hi all
I'm trying to read data from a dvd in order to check if the disc is ok or not
in c++ all is fine I read the files and do my tests
now I'm trying to port to c#, mostly for fun and to add a ui quickly.
what happens is: file reading is slower (about 1/3 the speed i get in c++) - code is below - and the files that contain the actual video data are locked.
I can unlock them running a dvd player, and I suppose I could find a way to do it on my own, still it's way too slow. do you have any idea about why it's so slow reading?
code
FileStream f = new FileStream(fl,FileMode.Open, FileAccess.Read, FileShare.None,16384);
while (0!=f.Read(ba,0,16384))
{
//do nothing - I just need to read the whole thing and time it
thanks!
|
|
|
|