|
You could look for the OnSessionEnd Message by over riding WinProc. Then programticly cause the application to close.
Hope this helps....
Forever Developing
|
|
|
|
|
Thanks for that, seems like a possible solution but....
I've been looking at an example for overriding the WinProc and it seems
easy enough. The message ID is stored in the .Msg property.
Is there somewhere that lists all of the different windows messages and their equivelant .Msg values?
Cheers
Kev
|
|
|
|
|
|
I think you should forget what I told you and follow the advice posted by Heath Stewart. His solution is a "More Managed Solution"
Anyway...
Forever Developing
|
|
|
|
|
hi,
I am executing a select() method agnest a data table. I got result as DataRow[]. Here i got collection of datarow.
My question is how can i create a table from this DataRow[] without executing all unwanted iteration(iterating through individual datarow or something).
Specifically : How can i create a table from a DataRow collection.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hi
If the result is the type of 'DataRowsCollection' then you can directly assign it to DataTable's Rows property.
If it is a collection of DataRows then you have to iterate one by one
M.Sendilkumar
TVS Infotech Ltd
Chennai
|
|
|
|
|
hi,
I think you didn't understood my question. See i don't want to iterate through any row hell. Do you have any other solution for this ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hi Sreejith
There is no other way.But we can minimize the work in iteration.
SqlConnection con=new SqlConnection(@"Data Source=YOURSERVER\INSTANCENAME;Initial Catalog=Northwind;UID=sa; PWD=sa;");
con.Open();
SqlDataAdapter adpt=new SqlDataAdapter("select OrderID,CustomerID,EmployeeID from orders",con);
DataTable dt1=new DataTable();
adpt.Fill(dt1);
DataRow[] dr=dt1.Select("customerid='vinet'");
DataTable dt2=new DataTable();
for(int i=0;i<dr.GetLength(0);i++)
{
dt2.ImportRow(dr[i]);
}
int a=dt2.Rows.Count;
------------------------------------
try this.
---------------------------
M.Sendilkumar
TVS Infotech Ltd
Chennai
|
|
|
|
|
Right now I am working with DataGrid.CurrentRowIndex
how to do if I have to select multiple rows.
Thank you,
======
Yo need a brain to code.
|
|
|
|
|
hi,
What is your real requirement ?. We can select more than one record in a datagrid. Select() method is used to select a perticular row. And Unselect() method doing the reverse of Select(). you can check whether a perticular row is selected or not by using IsSelected() method. I recommand you to read the DataGrid Class description in MSDN.;)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hello Sreejit,
I have used DataGrid_MouseUp() event and then used DataGrid.CurrentRowIndex to get the current row.
private void DataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
int i = DataGrid.CurrentRowIndex;<br />
}
But how can I get multiple rows index if I have selected multiple rows.
like this>>
private void DataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
for (int i = 0; i <= DataGrid.CurrentRowIndexes:confused:; i++)<br />
{<br />
int j = DataGrid.CurrentRowIndexes[i];<br />
}<br />
}
======
Yo need a brain to code.
|
|
|
|
|
//For collecting the index of selected records
ArrayList Ar=new ArrayList();
private void DataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
for (int i = 0; i <= DataGrid.CurrentRowIndexes; i++)
{
/*this line will help you to deside whether row is selected or not. If yes then it will return a bool value. Else will return a false value.*/
if(DataGrid.IsSelected(i)
Ar.Add(DataGrid.CurrentRowIndexes[i].ToString());
else
continue;
}
}
So finally you will get all index of selected row in your ArrayList.
Remaing is upto you to design based on your requirement.;)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Sreeji, Thank you very much. I appreciate your help.
======
code proj. rocks!
|
|
|
|
|
Hi, I wonder if it is possible to detect somehow (from C# app) when the Windows plays some specific .wav file?
What I wanna do is to "subscribe" for that event and do my job when some specific .wav file gets played.
Any ideas?
thanks!
|
|
|
|
|
You're most likely going to be able to do this simply by a mechanism that watches if a file is read, as opposed to played specifically.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
|
How to I paste text to and from clipboard while preserving the formating. Because when I paste from the clipboar, the text that use to be bol is not, etc...
Say from 1 textbox into another. Or from a textbox into a word document.
Thanks
|
|
|
|
|
|
I got it to copy, my question is that why it still looses format.
Storing Info:
IDataObject d = Clipboard.GetDataObject();
//d.SetData(DataFormats.Rtf, true, richTextBox1.Text);
// d.SetData(DataFormats.Rtf, richTextBox1.Rtf);
Clipboard.SetText(richTextBox1.Text, TextDataFormat.Rtf);
Retriving info:
foreach (Word.Shape bkMark in aDoc.Shapes)
{
if (bkMark.TextFrame.TextRange.Text.Contains("heading"))
{
// bkMark.TextFrame.TextRange.Paste();
bkMark.TextFrame.TextRange.Text = Clipboard.GetText(TextDataFormat.Rtf).ToString();
//Clipboard.GetDataObject().GetData(DataFormats.Text).ToString();
//
//
}
}
|
|
|
|
|
bkMark.TextFrame.TextRange.Text contains plain text by definition, if you want formatted text you'll have to use clipboard pasting.
To have control over what will actually get pasted you'll have to specify that you want RTF. IIRC there's a PasteSpecial (or something similar) where you can tell Word what format to paste.
Regards,
mav
|
|
|
|
|
Hi
I try to use GetPrivateProfileResString to quickly retrive .ini file information but I dont know how to make a declaration....
Does someone know?
busio
|
|
|
|
|
read this article.
http://www.codeproject.com/csharp/cs_ini.asp
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
S Sansanwal wrote:
http://www.codeproject.com/csharp/cs_ini.asp
http://www.codeproject.com/csharp/cs_ini.asp
[^]
This message brought to you by the click-it cops
Best,
Jerry
Contrary to the cliche, genuinely nice guys most often finish first or very near it.--Malcolm Forbes Toasty0.com
|
|
|
|
|
|
Hi,
I have a list view control with Label Edit Style.
When the user presses a key while an item is selected, Editing should start immediately.
I catch the KeyPress notification and enter edit mode, but I also have to set the edit's contents (or send the simulate the key event).
For that, I think I need the Edit control itself. Is this possible?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|