|
I saw SortedColumn & SortOrder, but I dont mind about the order, i need to be notify at my code when the user clicks into the header, systems re-sort the datagrid and then it should call me to put the selected row again to the right index.
|
|
|
|
|
Then between my 2 posts, you have the answer to your question.
|
|
|
|
|
DataGrid1_SortCommand ???
I saw that event but cant see it at DataGridView. Maybe im an absolutely n00b.
Thanx for your help,
|
|
|
|
|
Have you tried DataGridView1_ColumnSortModeChanged?
|
|
|
|
|
Yes i did before starting this thread yesterday, i usually try to check, find, read, test, google find, forums find, etc.. before asking.. and i thought that the problem that im stuck should be easy.
I placed an event on the ColumnSortChanged and click and the header, nothing happens...
Thanx again for your time ed,
|
|
|
|
|
Ok, I finally busted out a quick and dirty winform to find an event. This may not be the most optimized, but it works!!!
void DataGridView1CellMouseDown(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
{
DataGridView.HitTestInfo hit = dataGridView1.HitTest(e.X, e.Y);
if (hit.Type == DataGridViewHitTestType.ColumnHeader)
{
label1.Text = "Sorted";
}
}
|
|
|
|
|
Will try it, but dunno if it happens after the sort and redraw. Thanx for your time and i hope someday can help you.
|
|
|
|
|
OK, im going to try and explain this the best I can. I have a listview that shows things by category with an associated treeview for displaying specific categories. I have the ItemCheck event handler changing categories whenever an item is checked and remove it from the listview. the problem is if the item is the last item in the listview when the box is checked/unchecked the program.cs throws an argument out or range exception. does anyone know why or how to fix it?
|
|
|
|
|
based on your words
numbers1thru9 wrote: the problem is if the item is the last item in the listview when the box is checked/unchecked the program.cs throws an argument out or range exception. does anyone know why or how to fix it?
can you show your code??
"My advice to you is to get married. If you find a good wife, you will be happy; if not, you will become a philosopher." Socrates
|
|
|
|
|
private void lvTasks_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (lvTasks.Items[e.Index].Checked == false && lvTasks.Items[e.Index].SubItems[6].Text == "0")
{
//sql.makeCompleted(user_num, lvTasks.Items[e.Index].SubItems[4].Text);
taskList.Remove(lvTasks.Items[e.Index]);
lvTasks.Items[e.Index].SubItems[6].Text = "1";
lvTasks.Items[e.Index].SubItems.Add(DateTime.Today.Date.ToShortDateString());
completedTasks.Add(lvTasks.Items[e.Index]);
lvTasks.Items.RemoveAt(e.Index);
}
else if (lvTasks.Items[e.Index].Checked == true && lvTasks.Items[e.Index].SubItems[6].Text == "1")
{
completedTasks.Remove(lvTasks.Items[e.Index]);
lvTasks.Items[e.Index].SubItems[6].Text = "0";
lvTasks.Items[e.Index].SubItems[7].Text = "";
taskList.Add(lvTasks.Items[e.Index]);
lvTasks.Items.RemoveAt(e.Index);
}
|
|
|
|
|
Need a little help of adding \n to a string wherever a full stop appears in the text. I have looked at the relpace method, but as stated this replaces the specified character.
|
|
|
|
|
str.Replace(".", "." + Environment.NewLine);
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
string mystring= "This.is.a.test";<br />
string[] splitedData= mystring.Split('.');<br />
string result= "";<br />
<br />
for (int i = 0; i <= splitedData.Length-1; i++)<br />
{<br />
result= result+ splitedData[i].ToString() + "\n";<br />
}
"My advice to you is to get married. If you find a good wife, you will be happy; if not, you will become a philosopher." Socrates
|
|
|
|
|
You never want to hardcode the "\n" in .NET any longer. Use Environment.NewLine.
|
|
|
|
|
|
Hello,
edboe wrote: Use Environment.NewLine
good info!
Is there also a function for "\r\n"?
Thanks for youre help.
Martin
|
|
|
|
|
Martin# wrote: Is there also a function for "\r\n"?
There is. It's called Environment.NewLine .
MSDN topic of Environment.NewLine Property[^] states that the property value is "A string containing "\r\n" for non-Unix platforms, or a string containing "\n" for Unix platforms."
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Stefan Troschütz wrote: There is. It's called Environment.NewLine ;)
again and again
Thank you Stefan!
Maybe next time I do a little researche.
Martin
|
|
|
|
|
Hi.
Does anyone know haw exactly does the Windows OnScreenKeyboard work?
To be more specific, I'm interested in how it simulates the actual keystrokes (not like SendKeys.SendWait(), SnedMessage() or PostMessage() work, but like you're really working with the keyboard).
Another thing of interest is how it never takes the focus when you click the keys?
I've tried to simulate it using SendKeys,SendMessage or PostMessage, but I always need to transfer the focus back on the receiving form, which is obviously not a good approach.
Can anyone give me a hint?
|
|
|
|
|
Hello,
I have created a CustomEventLog. I am using the EventLogInstaller class and using Installutil.exe to install my log. However I notice that the MyCustomLog.Evt file is not being generated?
Does anyone know how the .Evt file gets generated?
Thanks so much for the help.
RB
|
|
|
|
|
I don't know about using Installutil.exe to install an event log, but I do know that when you create an Event Source using EventLog.CreateEventSource(), the event log will be created automatically if it doesn't exist already.
if (!EventLog.SourceExists("SourceName"))
EventLog.CreateEventSource("SourceName", "LogName");
will create an event log for you named LogName.evt (it will be in the \System32\config directory) with a Source of SourceName .
To write to it:
EventLog myLog = new EventLog("LogName",".","SourceName");
myLog.WriteEntry("Loggin my event...");
Documentation:
EventLog.CreateEventSource Method (String, String) [^]
This method can also create a new custom log on the local computer.
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Thank you.. I have been doing it this way as well. I just did not see my new LogName.evt showing up in my \System32\config directory. However I restarted my system and the file appeared. Go figure.
Thank you.
RB
|
|
|
|
|
Hello...
Does anybody has this bug also ?
If you open a file in VS2005 (File | Open - File), then just select a directory with a lot of icons.
Then you can see, the icons for the files are wrong. It should be : ICON[i] = FILES[i-2].
But in OpenFileDialog is ok.
|
|
|
|
|
I do no experience it. How many icon files do you have?
Alexandru Ghiondea
MCP
|
|
|
|
|
Bug? In Microsoft Software? No way!!!
That one I have not seen.
|
|
|
|