|
hi Luc Pattyn
in win app, when u start cmd.exe from your app, u can set input/output to your app(did u test my code ?), but my problem is not that, my problem is that how to prevent to display command prompt when i run cmd.exe with useSellExecute set to flase.
thanks
|
|
|
|
|
Try setting CreateNoWindow property to true.
|
|
|
|
|
thanks.
my problem was solved by your suggesstion.
|
|
|
|
|
You are welcome
|
|
|
|
|
Greetings,
Mostly I use enumerations to specify a list of constants that are connected.
However, recently I needed to create a code that does the following:
Paint a line with a specific color that is set by the value of the bits in a variable.
The bits values are arranged in enumeration:
enum bits
{
Switch1 = 1,
Switch2 = 2,
Switch3 = 4,
switch4 = 8,
}
What is the best way to assign a color to each switch?
I thought of two ways:
---------------------------------------------
creating a dictionary and set its values in runtime:
Dictionary<bits, color=""> Bits_Colors = new Dictionary<bits, color="">;<br />
<br />
Bits_Colors.Add(switch1, Color.Red);<br />
Bits_Colors.Add(switch2, Color.Ivory);<br />
..</bits,></bits,>
But this solution because the dictionary is not constant and readonly would not help here.
-------------------------------------------------
Creating another enumeration for the colors and using thier names as params to Color.
<br />
enum BitsColors<br />
{<br />
Red = 1,<br />
Ivory = 2.<br />
Blue = 4,<br />
Green = 8<br />
}<br />
<br />
string name = Enum.GetNames(bits, (int) switch2 );
Color c = Color.MakeByName(name);
-----------------------------------------------------------
I wrote the code from my memory so it might be a little not working.
Sincerely yours
Y.R.
|
|
|
|
|
How about an array ? A constant array of colors, and you reference it by index, using the value that is the combination of your bit values.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for your reply.
I thought of that but there are two problems:
First, I don't think there is an easy way to make array a contant (except for basic types arrays).
Second, my bits values are not 1, 2, 3, 4... (which would fit to an array).
They are 1, 2, 4, 8, ... (Which requires some logic to be implemented in an array).
I thought of constant dictionary but I don't think there is a way to make the dictionary constant or readonly.
Sincerely yours
Y.R.
|
|
|
|
|
You could use attributes, but the code can be verbose and (perhaps) inefficient.
I'd stick with the readonly static Dictionary idea; wrap it in something so the code that uses it can't change it.
|
|
|
|
|
I thought that this is the only way.
It strange that such a powerful language don't have this simple features.
Thanks for your help.
Sincerely yours
Y.R.
|
|
|
|
|
Microsoft tends to do the hard stuff and leave the easy stuff to you. (Which is better than the other way around.)
|
|
|
|
|
How to load HTML file using XmlDocument class
I try to do
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(path);
but html document not considered by doc.Load method like regullar xml document since what have some unclosed tags such as an other unwell formated things(<link)>Can i actually load this html file by using System.Xml.XmlDocument() for purpose transform this HTML file into an XML file by using XSLT.
THANK
|
|
|
|
|
As you have found, not all HTML documents are XHTML. Therefore, a DOM class will not load them. An XSLT can generate non XML documents, but it cannot work with documents that are not XML to start with, you need a different solution.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
HTML doesn't conform to XML standards. However XHTML does. The following text comes from the Wikipedia article for XHTML:
Whereas HTML is an application of Standard Generalized Markup Language (SGML), a very flexible markup language, XHTML is an application of XML, a more restrictive subset of SGML.
A solution to your problem would be to convert your HTML code to XHTML which can be understood by the XML parser. I'm not aware of a component that can do this. However this article[^] explains the processes involved.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Personally, I do use SgmlReader[^].
In addition you could use my Zeta Html Tidy[^] library.
I am using both, SgmlReader andy Zeta Html Tidy, together in some projects.
|
|
|
|
|
|
hi
i have datagrid, i pick some records (CTRL + rows)
i want to run over the datagrid and to read only the
rows that i pick
how can i do this ?
thank's for any help
|
|
|
|
|
|
I use below code to fill the DataAdapter with a table contents, but the table name contain space such as "Table Name" I am using replace method to elemnate space from the table name to become "TableName" because when filling DataAdapter it returns an error and even with using the replace method I receive an error such "Syntax error in query. Incomplete query clause."
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
DataSet1 ds = new DataSet1();
string stconn = "connection string";
OleDbConnection conn = new OleDbConnection(stconn);
string deletespace = this.treeView1.SelectedNode.Text.ToString();
string Deletespace = deletespace.Replace(" ","");
OleDbCommand command = new OleDbCommand("select * from '" + Deletespace.ToString() + "'", conn);
conn.Open();
OleDbDataAdapter Adapter = new OleDbDataAdapter();
Adapter.SelectCommand = command;
Adapter.Fill(ds, Deletespace.ToString());
}
hawari
|
|
|
|
|
Wow.
ahawari09 wrote: string Deletespace = deletespace.Replace(" ","");
Why create a new string ?
ahawari09 wrote: Deletespace.ToString()
What do you think 'ToString' does when called on a string ?
ahawari09 wrote: ("select * from '" + Deletespace.ToString() + "'", conn);
Why are you putting the table name in quotes ?
ahawari09 wrote: conn.Open();
OleDbDataAdapter Adapter = new OleDbDataAdapter();
Adapter.SelectCommand = command;
Adapter.Fill(ds, Deletespace.ToString());
Why don't you close the connection ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am using treeview control to display table contents and when I duble click the selected node I display a spacific table contents in a listview control, to do that I have to pass table name which is the selected node.text to the select statment then to the DataAdapter. There is one problem table names should not contain space or it will not run without an error. So I am tring to remove space from node.text.
hawari
|
|
|
|
|
Wow. OK, this is a total disaster, not in least because you plainly have no idea. Buy a book on SQL and read it, please.
A table name NEVER goes in quotes, this is the source of your error. If a table name has spaces in it, in the database, you use [] to reference it, as in [my table with a stupid name]. I'd never use spaces to startwith, but leading and trailing spaces ( which you can remove with the Trim method if you like ) are not doing to stop the code from working.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Wow. I belive you are the one who has no idea, because you did not realy understand the problem. First of all I am not working with SQL server to produce the code I sent to you, I am working with C#. That is why you can see embedded SQL "with a stupid name" table goes in quotes. Thank you and please you don't have to reply to any of my questions.
Regards,
hawari
|
|
|
|
|
By the way, you don't have to use .Text for the table name. There's a tag of object type where you can "tag" the table name to, or in more complex case, you can tag a class object that contains the table name plus other information, ie the whole select statement, for example.
By, by the way, table name in SQL statement should not be enclosed by single quotes.
|
|
|
|
|
|
When right-clicking a file in Windows Explorer, e.g. a JPEG image, a list of possible applications is presented ("Open with" submenu).
Is it possible for my application to read this list for a certain file type, too?
I tried several different ways like the registry etc. but found no suitable way.
Thanks
Uwe
|
|
|
|