|
Well, eventually yes. This was just a small test of adding 10 items consecutively to the linked list using a loop. You can use it largely as a stack -I assume you know the difference between a stack and a queue-. In real life you'd be using more complex linked lists -if wou'd use them at all-.
If you get errors or have trouble again, don't hesitate to post.
Regards
|
|
|
|
|
Hi,
Does anyone have some idea about how to implement parent/children rows in Datagrid control if I bind ArrayList to the datagrid.
I want to fold the children rows in some cases. also the parent have similar data structure as children.
Thanks in advance!!
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
The MS provided GridView doesn't support this so you'll need to use a control such as Infragistics' UltraWebGrid or write a lot of display code yourself.
only two letters away from being an asset
|
|
|
|
|
hi to all
can anybody explain about overload,override,abstract with example code
thanks in advance
regards
saravanan
|
|
|
|
|
An overload is having 2 methods named the same, but which provide a differing number of arguments. This is useful in many ways and can simulate optional arguments
public void DoSomething()
{
DoSomething(true);
}
public void DoSomething(bool special)
{
}
An override is used to redefine a virtual method from a base class. This allows you to change the behaviour of your objects.
class MyBase
{
public virtual void DoSomething()
{
MessageBox.Show("Something from MyBase");
}
}
class MyDerived : MyBase
{
public overload void DoSomething()
{
MessageBox.Show("Something from MyDerived");
}
}
An abstract class is one that cant be directly instantiated, it must be inherited and given default behaviour for all abstract members.
|
|
|
|
|
Typo: overload should be override
J4amieC wrote: class MyBase
{
public virtual void DoSomething()
{
MessageBox.Show("Something from MyBase");
}
}
class MyDerived : MyBase
{
public overload void DoSomething()
{
MessageBox.Show("Something from MyDerived");
}
--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
|
|
|
|
|
Yup, sorry and well picked up...
|
|
|
|
|
Overloading :
a particular operator / method doing different tasks:
Same method name, Different parameters.
example: method overloading
public void PrintString(String str)
{
Console.WriteLine(str);
}
public void PrintString(int n)
{
Console.Writeline(n.ToString());
}
In the above example PrintString method is overloaded, that is there are two methods that differ by parameter. This is mandatory for overloding, i.e the method parameters must differ. if just the return types differ, the code will not compile. There is no keyword called overload.
Overriding:
If we have a method in our class and feel there is possibility that any class that inherits our class might need to implemt our method in a different way, we have to make our method virtual. Only abstract / virtual methods can be overridden.
public class classa
{
protected virtual void MyMethod()
{
//some code
}
}
public class classb: classa
{
protected override void MyMethod()
{
//slightly different code
}
}
Abstract:
Abstract methods are those that have no implementation, abstarct methods can reside only in abstract classes, and any class which inherits the abstract class "MUST" override the abstract method and give proper implementation.
hope this helped.
Baba thts what they say, B to the A to the B to the A
|
|
|
|
|
Hi,
Im trying to detect when user changes the order of a DataGridView to after that select the right row again due RowIndex changes. Before it i have my Row selected by a field on the Cell Table. Seems easy but im not able to find the event o something telling me "Hey dude, user changed order clicking at headers, i finished painting and you should re-select the right row again"
Hope you catch me and somebody nows how to do it,
Sorry about my english and many thanx in advance,
|
|
|
|
|
Before doing the sort, save a reference to your key field. Do the sort. Find the key value from your key field to select it.
|
|
|
|
|
Hi, thanx but i had the reference already, the problem is to find which event is fired after a header column sort to place the selected row index again.
|
|
|
|
|
have you checked DataGrid1_SortCommand ?
|
|
|
|
|
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
|
|
|
|