|
Hi!
Is it possible to redirect the output from Process.Start to a textfile or (even better) a variable?
I'm using Process.Start to invocate ipconfig to get the mac address..
Thanks in advance,
-K
|
|
|
|
|
Use Process Start Info to indicate that the process will redirect its std out, in , and err then on then create a process object with the start info as a parameter. Set event listeners on the process for the 3 streams and viola.
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
|
|
|
|
|
Bien! Just what I wanted. Thanks a million...
-K
|
|
|
|
|
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
//p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "ipconfig.exe";
p.StartInfo.Arguments = ("/all");
p.StartInfo.RedirectStandardOutput = true;
p.Start();
p.WaitForExit();
string s = p.StandardOutput.ReadToEnd();
Console.WriteLine(s);
Console.ReadKey();
-K
|
|
|
|
|
Hi,
I am deploying a C# application and along with that, i am also deploying SQL Express. Now i want to create the account for user of that application. Please tell me how can i do that.
Regards,
Wasif Ehsan.
|
|
|
|
|
Hi,
I am having problem in writing the stylesheet using C# code-behind. I have written a code, but it is not affecting my pages. Can any one please tell me how to write... This is the code
/*<![CDATA[*/
#banner { background-image:url../images/banner1.jpg) }
#splash{background-image:url(../images/active_bg.jpg) }
/*]]>*/
and I have written like this....
protected void Page_Init(object sender, EventArgs e)
{
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Href = "~../Css/landing.css";
Page.Controls.Add(link);
HtmlLink linkMain = new HtmlLink();
linkMain.Attributes.Add("type", "text/css");
linkMain.Attributes.Add("rel", "stylesheet");
linkMain.Href = "#banner{ background-image:url(../images/banner1.jpg) }";
Page.Controls.Add(linkMain);
HtmlLink linkSplashButtons = new HtmlLink();
linkSplashButtons.Attributes.Add("type", "text/css");
linkSplashButtons.Attributes.Add("rel", "stylesheet");
linkSplashButtons.Href = "#splash{ background-image:url(../images/active_bg.jpg) }";
Page.Controls.Add(linkSplashButtons);
}
Can anyone please tell me how to write this
Regards
Rukmini
-- modified at 13:27 Friday 28th July, 2006
|
|
|
|
|
I really have no idea what you are trying to do with that code?
Anyway if all you want is a style sheet to affect your page, put this in the markup:
In the header:
<link href="pathToStyleSheet" rel="stylesheet" type="text/css" />
In Body:
<div id="banner">some stuff</div>
<div id="splash">some other stuff</div>
And if you have #banner and #splash in the .css file you load with the <link> tag then the styles will be applied.
-- modified at 13:36 Friday 28th July, 2006
|
|
|
|
|
Sorry ..May be I am not clear in my question
I am working on content management system. It is having a master page,
and all the other aspx pages are having the asp:Content. The content of the aspx pages must appear in the contentplaceholder of the master page. All the aspx pages are having different stylesheets. So for every aspx page I must add the stylesheets in code-behind.
While trying to add the stylesheets from code-behind I am facing problem.
|
|
|
|
|
Ahh I understand now.
Put a Label in the <head> in the MasterPage. Then in the page_load for the .aspx page put something like:
((Label)MasterPage.FindControl("lblStyleSheet")).Text = "<link href='yourStyleSheet.css' rel='stylesheet' type='text/css' />";
|
|
|
|
|
Now this part is working
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Href = "../Css/landing.css";
Page.Controls.Add(link);
the error is..by mistake I have given like this
link.Href = "~../Css/landing.css";
Now for this two I am unable to find out what is the problem.
HtmlLink linkMain = new HtmlLink();
linkMain.Attributes.Add("type", "text/css");
linkMain.Attributes.Add("rel", "stylesheet");
linkMain.Href = "#banner{ background-image:url(../images/banner1.jpg) }";
Page.Controls.Add(linkMain);
HtmlLink linkSplashButtons = new HtmlLink();
linkSplashButtons.Attributes.Add("type", "text/css");
linkSplashButtons.Attributes.Add("rel", "stylesheet");
linkSplashButtons.Href = "#splash{ background-image:url(../images/active_bg.jpg) }";
Page.Controls.Add(linkSplashButtons);
|
|
|
|
|
can anyone please send any intresting miniproject using only c.it should be not too long a maximum of 200lines.waiting 4 reply.plz replysoooooon.
|
|
|
|
|
Sure thing. Here you go. I hope it's not too long. Anything else we can do for you?
void main(){} /ravi
|
|
|
|
|
This is a C# forum, not C.
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
Write your own code or take the FAMOUS PROGRAM IN THE WORLD :
Console.WriteLine("Hello World");
|
|
|
|
|
Hi,
I am deploying a c# database with which i am also deploying SQL express. I need to deploy database after installation as well. I have the .mdf file. I want to know how can i place the .mdf in the appropriate folder. ( And also which folder is apporpriate for this purpose).
Regards,
Wasif Ehsan.
|
|
|
|
|
This would be better in the SQL forum, but here you go... my company does this and distributes the .mdf file and then runs a SQL script to attach to the database. I think it is a better solution to build a SQL script for the database and have it create the tables, stored procedures, etc instead of distributing the .mdf file. But if you must, you can put the .mdf file anyplace on the drive and use the sp_attach_db stored procedure.
sp_attach_db @dbname = 'Pat',
@filename1 = 'C:\db\Pat.mdf',
@filename2 = 'C:\db\Pat_log.ldf'
Steve Maier, MCSD MCAD MCTS
|
|
|
|
|
Hi
Is it possible to show different image in one column in each row depending on status of other column in the grid?
For example:
stop o
running ~
waiting x
I wouldn't like to create my own class representing ImageCell. Just using CellPainting event.
I do like this in CellPainting:
e.Graphics.DrawImage(img, e.CellBounds);
img depends on value of another column (status)
...but it doesn't work. Image is drawn and disappears
Thanks
Ela
|
|
|
|
|
e_LA wrote: Image is drawn and disappears
It's hard to help you without seeing the context of the drawing code. If it's drawn but then disappears, either you're drawing code is wrong or you're drawing in the wrong place.
|
|
|
|
|
Ok
When I put only such a code in cellpainting event
private void myDataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex > -1 && e.RowIndex > -1)
{
Image img = global::MyApplication.Properties.Resources.GreenImage;
e.Graphics.DrawImage(img, e.CellBounds);
}
}
Anything is drawn. Why?
In fact it is drawn and dissapears - I checked it.
What is wrong?
|
|
|
|
|
Instead of setting up a CellPainting handler, define a DataGridViewCell type and override the Paint method, then put your painting code inside that overridden method.
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
|
|
|
|
|
What is a difference between overriding the Paint method and setting up a CellPaining handler?
Can I define a DataGridViewCell type and add it to an existing column?
Thanks for help
Ela
|
|
|
|
|
Ok I defined my own class representing column and cell class where I overriden a Paint method.
In the Paint method I would like to draw image depending on value of another column.
I have to take DataSource (DataView) where I could check the value in another column in the same row (RowIndex).
That's why I created cell constructor like that
public ImageCell(DataGridView dGridV)
{
this.grid = dGridV;
}
When in Paint method I put such a line
DataView dv = (DataView)grid.DataSource;
I have an exception because grid is null.
I think during adding column to grid operation default constructor of the cell is called (which is empty in my case). Am I right?
Thanks
Ela
|
|
|
|
|
Yes, it works now. I have only message on Console window:
FormattedValueType property of a cell cannot be null.
I tried to override FormattedValueType property but it doesn't not works.
Another thing is sometimes I have to display animated gif in the cell.
However when I want to animate gif I have to call Invalidate method which does not exist for the cell.
Thanks
Ela
|
|
|
|
|
Hi All,
I have a problem combining results of two queries. The queries are fired on the same table with the same select list, only the where condition changes. It would be better if i show what i actually want.
This is my table data for example.
Field1 Field2
AB 1
SD 2
SDFG 3
AS 4
QWE 5
BBG 6
I want an output as
Field1 Field2
AS 4
QWE 5
BBG 6
AB 1
SD 2
That means , if i give the value for Field2 = 3 in the query then the result will not contain record with Field2 = 3 and the result should display the record with Field2 > 3
first and the with Field2 < 3 both sorted in ascending order.
I am using the union operator for combining results, but the results are not as desired. Also i feel that the union clause is not efficient since it takes about 4-6 secs to fetch the records.
Is there any efficient solution for my problem. Please reply soon as i have already spent considerable time on this query and i am running short of time now.
Any help will be appreciable.
Thanks in Advance.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
SELECT field1, field2
FROM table1
WHERE field2 > @someNumber
UNION
SELECT field1, field2
FROM table1
WHERE field2 <= @someNumber
The only problem is the order by clause is applied to the entire union at the end. So we need to cheat a little
SELECT field1, field2, 0 as ignoreMe
FROM table1
WHERE field2 > @someNumber
UNION
SELECT field1, field2, 1 as ignoreMe
FROM table1
WHERE field2 <= @someNumber
ORDER BY ignoreMe ASC, field1 ASC, field2 ASC
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
|
|
|
|