|
|
Any ideas what I'm really meant to be doing in the lines marked as "won't compile" below?
<br />
using System;<br />
<br />
namespace Test<br />
{<br />
public class MyClass : GenericsTest<<MyClass>><br />
{<br />
public void DoSomething()<br />
{<br />
base.DoSomething();<br />
}<br />
}<br />
<br />
public class GenericsTest<<T>> where T : class<br />
{<br />
SomeHelperClass<<T>> helper;<br />
<br />
public GenericsTest()<br />
{<br />
helper = new SomeHelperClass<<T>>();<br />
}<br />
<br />
public void DoSomething()<br />
{<br />
helper.DoSomething(T);
helper.DoSomething(this);
}<br />
}<br />
<br />
public class SomeHelperClass<<T>> where T : class<br />
{<br />
public void DoSomething(T target)<br />
{<br />
}<br />
}<br />
}<br />
TIA!
-- modified at 21:11 Thursday 3rd August, 2006
Bah, the lt's and gt's get nuked when posting - just imagine the double lt's and gt's are actually single..
-- modified at 21:12 Thursday 3rd August, 2006
|
|
|
|
|
Furty wrote: just imagine the double lt's and gt's are actually single..
Or you could check the 'Ignore HTML tags in this message (good for code snippets)' box.
Furty wrote: helper.DoSomething(T); // won't compile
T is a type. You want to pass in an instance of T.
By the way, posting error messages is far more helpful that 'it won't compile'
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Furty wrote: helper.DoSomething(T); // won't compile
That should compile.
Furty wrote: helper.DoSomething(this); // won't compile
That shouldn't compile. You are clearly passing the wrong type.
|
|
|
|
|
what is the best way to print a windows application form.
|
|
|
|
|
There is no "best" way, it depends on what you are trying to accomplish. Do you have a more specific question or problem?
only two letters away from being an asset
|
|
|
|
|
I am creating a form from a pdf and it is to draw material from a database to populate the form. Then I need to be able to print or save to a pdf.
|
|
|
|
|
I've had to do this once. We used a third party library of which I can't remember right now.
only two letters away from being an asset
|
|
|
|
|
The best way to print from a window application is using crystal reports. Then as my friend said all depends on what kind of application ur working with. Basically if u r to show something like a report the best way to do is by creating crystal reports.
Vipin
|
|
|
|
|
Vipin Venugopal wrote: The best way to print from a window application is using crystal reports.
I bit of overkill if you ask me. Plus the overhead of CrystalReports, licensing etc.
only two letters away from being an asset
|
|
|
|
|
Hi guys,
A general question, is there a disadvantage/advantage of working with the registry or XML document. Do Admin rights issue come in if you are saving everything on the registry?
Please advice.
sasa
|
|
|
|
|
Off the top of my head, XML seems the safest. Because, even if the user had Power User privildges, they still can't edit other accounts - so some reg keys might not be accessable.
I'm running power user right now, and I can't install many things, e.g. Flash, VS Express, DirectX, WGA Plugin, Alcohol 120%, etc...
However, I CAN install firefox.
I'm not sure what the pattern is....
/\ |_ E X E GG
|
|
|
|
|
hi all,
how can i find index of selected cell in a row ?
i have a textbox on my form.
and i want to assign the selected cell's value to the textbox.
what should i write into which event ? selectionchanged ¿
help please...
thanks in advance,
bye.
|
|
|
|
|
use datagridview.SelectedCell.Row
this gives the row no.
Regards,
Pramod
|
|
|
|
|
i want 2 automate the proccess of login into site usin Htaccess.. and instead of enetering the user/pass in the annoying popup window i wanna login directly into the site.. .like http://user:pass@www.blah.com... but this is not available in IE..
so i wodered if there any way from c# (maybe using axWebBrowser, or something else) 2 fill the 2 fileds of user/pass automaticly into the pop up window, or skip it completly
cause i open the ie from c# like that:
System.Diagnostics.Process.Start("iexplore.exe",site)
and i have the user/pass already stored in xml file...
so i dont wanna retype it again int the pop up window of HTaccess
thx ahead!
-- modified at 6:21 Friday 4th August, 2006
|
|
|
|
|
Is there anyway to create a standalone dropdown button thats not in a toolbar strip?
Thanks, Ben.
|
|
|
|
|
You could make a custom control that would mimic the Toolbar Strip Drop Down Button.
Regards,
1tg46
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
|
|
|
|
|
Greetings:
Im trying to change an image to only two colors (B&W) based on a threshold value, to do this i first turn it to grayscale using a colormatrix, then, if the rgb grey value is bigger than the threshold value it turns black, if its lower it turns white, or viceversa. As for now, im doing this pixel by pixel, but its too slow, is there a better, faster way for doing this, and if so how?
Thanks in advance
"Failure is the best reason to start all over again with more knowledge"
-Henry Ford
|
|
|
|
|
Heh, faster ? Shameless plug
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I use the Process class to launch a DOS program. At times the DOS program comes to a puse waiting for user input. I want to check if it is waitng for a user input. i searched and came across a method called Process.WaitForInputIdle . Hoever, this only seems to work with application with a GUI. What do i do? Is there another way i could check of the DOS program is waitng for user input?
|
|
|
|
|
I'm working on a Word add-in with a custom menu. When the Word is started, the Add-in is loaded and menu is created. But the same Word instance(Windows process) is used by Outlook and I don't want the menu to work if the current Word document is an email. We have other application which uses Word inside it as well. Window.EnvelopeVisible property just apply to Outlook. Is there any general way to find out whether a Word document is under another container application such as Outlook?
Thank you very much.
James
|
|
|
|
|
ok so perhaps not c# specific but its the language im using so...
i have some (hopefully) thread-safe code that accesses some shared fields using the lock statement but im trying to avoid full-on locking.
i need to update a field only if the result does not exceed some other value.
i found the following code for simple value update (in the CompareExchange() example):
do {
initialValue = totalValue;
computedValue = initialValue + addend;
} while (initialValue != Interlocked.CompareExchange(ref totalValue, computedValue, initialValue));
now, if i use the following would it be properly thread-safe and do wot i need..?
do {
initialValue = originalValue;
result = initialValue + addValue;
overFlag = result > maxValue;
if (overFlag) result = initialValue;
} while (initialValue != Interlocked.CompareExchange(ref originalValue, result, initialValue));
overFlag is bool and would be used after the udpate code to determine whether to continue or not.
i cant quite get my head around it.
thanks in advance
I worship his divine shadow.
|
|
|
|
|
Hello!
How do you reorder ToolStripMenuItems in MenuStrip at runtime?
Here's some sample code:
//create the MenuStrip here and add a File menu with an Exit MenuItem on it.
MenuStrip ms = new MenuStrip();
ToolStripMenuItem file = new ToolStripMenuItem("File");
ToolStripMenuItem fileExit = new ToolStripMenuItem("Exit");
file.DropDownItems.Add(fileExit);
ms.Items.Add(file);
//Add a Print MenuItem to the File Menu
ToolStripMenuItem filePrint = new ToolStripMenuItem("Print");
file.DropDownItems.Add(filePrint);
At this point, the File menu will have the Exit menu item, and then the Print menu item below it. How do you change the order, and move the Print menu item to the top?
Background: I'm creating a _MenuStrip control that inherits from MenuStrip, and will have default MenuItems for all menus in the application, such as File/Exit, and Help/About, etc. I plan on creating additional MenuStrips that inherit from my base _MenuStrip control, and I will need to add and remove MenuItems at runtime.
Thanks!
Gary
|
|
|
|
|
You can reorder them by changing the order they're in the DropDownItems collection.
file.DropDownItems.Remove(filePrint);
file.DropDownItems.Insert(0, filePrint);
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Thank you very much! That does handle the reordering of the MenuItems.
There is only 1 caveat to this approach, that is that the EventHandler for the MenuItem that is being removed will be lost when the MenuItem is removed and re-inserted. How can you get the EventHandler for the MenuItem before it is removed, and then reassign it after it is added back again?
Thx.
|
|
|
|