|
|
I'm writing a terminal application and I want to open a file through FileOpenDialog. This class need using System.Windows.Forms;
I can't do it under terminal applicaton.
How can I do that? Do I need change some project options? Please tell me the details. I/m a new c# programmer
Thnak you
|
|
|
|
|
Just add a reference to System.Windows.Forms.dll to the project and you should be fine. (Right click on Project in Solution Explorer, click Add References, select System.Windows.Forms.dll in the listbox that comes up).
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thank you for your help. It works.
I have another question. In windows application I can write System.Console.WriteLine( "something" )
The program complies with no problems but the console never showup. Is there any solution?
Thank you
|
|
|
|
|
Are you sure you want a console to appear? Maybe you can make do with writing to the Trace?
In any case, the reverse of what you did the first time will solve your problem. Create a console application and copy/paste the form code in Main.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Here's the setup...I have 3 overlapping UserControls and I'd like for all but the last one to be fully transparent. My problem, however, is when I set the appropriate styles, etc., the transparency effect goes all the way through the controls and all I can see if the underlying Form. This obviously isn't what I want.
Think 3 Frames... event_frame, drag_frame, render_frame. The event_frame handles the simple mouse events, the drag_frame displays and dragging/drawing upon mouse movement, and the render_frame displays all the finialized objects.
So basically I'd like for the event & drag frame to be transparent, but for the effect to stop at the render_frame. Obviously I'm fairly new to C#, so if I've missed something basic I apologize.
And one other quick question...I was wondering if there was an effective way of Clearing a graphics object? And not like the current .Clear(Color.*) method. Is there some way in which to just dump the contents of the graphics object? This one has me stumped as well.
Yet any help or suggestions on where to find a good solution would be greatly appreciated, thanks!
|
|
|
|
|
And to add a note to my second question there...I've tried using the alpha bit set to 0
*.Clear(Color.FromArgb(0,Color.White));
and that simply produces and entirely black UserControl. Just thought I'd mention that as a way I've tried to 'transparently' .Clear() a graphics object...to no avail.
|
|
|
|
|
how can i do it for a toolwindow?
|
|
|
|
|
Can't you just set those properties on the form in the designer ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In Properties set control box to false.
|
|
|
|
|
Hi,
I am transforming an input XML documnet using XSL. I have a follg code to do that. The issue is that in my o/p XML, I have a few empty tag elements - When I test my xsl using XMLSPY, the o/p xml contains empty tag elements with short tags in it, which is desired (i.e. <mytag attrvalue="abc"/> ).
However, XML generated from C# code, has the empty tag elements with expanded end tag (i.e. <mytag attrvalue="abc"> </mytag>). This is not what I want.
Does anyone know how to tell C# code/class to create short end tags (i.e. singleton type). Below is my C# code:
public XmlDocument TransformXml(XmlDocument doc, string xslFile)
{
StringBuilder sb = new StringBuilder();
TextWriter tw = new StringWriter(sb);
XslTransform xsl = new XslTransform();
xsl.Load(xslFile); //load xsl file
xsl.Transform(doc, null, tw, null); //does transformation
XmlDocument ret = new XmlDocument();
ret.LoadXml(sb.ToString());
return ret;
}
Thanks,
Ken
|
|
|
|
|
what are the differences?
|
|
|
|
|
When you compile in debug mode, it creates debug information so that you can use the debugger. Also you get more information in the error messages.
---
b { font-weight: normal; }
|
|
|
|
|
|
Additionally to the debug information no optimizations are done.
Some optimizations would make it hard to debug your code (i.E. inlining, removal of unused variables, loop-unwinding etc.).
In release mode those optimizations make your program run faster (not always notable, depends on your design and what your program does.)
/cadi
24 hours is not enough
|
|
|
|
|
|
Hi,
I wanted from my server computer running XP, log off/lock a client machine found on my home network using C#. Is that possible? Give me some hints..
|
|
|
|
|
Off the top of my head...
You can set up a client/server application on the two machines respectively, and then send a certain message from the client program to the waiting server and depending on the message received have the server execute that particular command, whether it be shut down, log off, lock etc.
On the server to log off, shut down and junk, look into the windows api and pinvoke the needed functions to preform those operations. Off the top of my head to shut down is ExitWindowsEx , just poke around it shouldn't be hard to find.
But, once you log out remotely, you won't be able to log back in remotely. I don't think...
/\ |_ E X E GG
|
|
|
|
|
right thanks.. any one has an actual sample of a code of a form with a lock/unlock button on the client where i can log off or lock the client. Once i know how to do that locally, I should be able to do it remotely. thanks
|
|
|
|
|
Hi,
I have two Forms (A and B). When Form A is active I open Form B. I then want to run some code automatically in Form A when I close Form B. How do I do that?
Thanks,
Carl-Johan Larsson
|
|
|
|
|
I assume FormB is not modal - that is, you show it so that it floats but you can still use FormA ( you call Show instead of ShowDialog ). You need to create a function in FormA that looks like this:
private static void dlg_Closed(object sender, EventArgs e)
{
}
then before you show FormB in FormA, you do this ( assuming dlg is the name of your FormB class instance:
dlg.Closed += new EventHandler(dlg_Closed);
There is also a Closing event, which get's called BEFORE the form closes. Now add your code to the method you added to FormA.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Did the trick, Thanks Carl-Johan Larsson
|
|
|
|
|
|
Awesome! Thanks for the info. Looking forward to the Wintellect PowerThreading library I've heard to be in the works...
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
I'm writing a small app, and I have to prepare a form which will authenticate users. This is the code I wrote. The problem is I get exception in the marked line : "no value given for for on or more required parameters"
What is wrong with it?
Table name is users.
Column name is UserName
<br />
public void userExists(string username)<br />
{<br />
try<br />
{
string sqlFinduser = "SELECT COUNT(UserName) AS UserNameExists " +<br />
"FROM users " +<br />
"WHERE (UserName=" + username + ")";<br />
<br />
OleDbCommand cmdFindsqlFinduser = new OleDbCommand();<br />
<br />
cmdFindsqlFinduser.Connection = cnSurvey;<br />
cmdFindsqlFinduser.CommandType = CommandType.Text;<br />
cmdFindsqlFinduser.CommandText = sqlFinduser;<br />
<br />
cnSurvey.Open();<br />
<br />
int count = int.Parse(cmdFindsqlFinduser.ExecuteScalar().ToString()); <br />
<br />
bool exists = count != 0 ? true : false;<br />
<br />
cnSurvey.Close();<br />
<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
<br />
}<br />
<br />
TIA,
Ronen
|
|
|
|