|
You can also set the IComparer for a SortedList - so you can write whatever comparer you like.
----------------------------
Be excellent to each other
EasiReports[ ^] My free reporting component for WinForms.
|
|
|
|
|
Thing[] things = manager.GetThings();
private SortedList<string, object> list = new SortedList<string, object>();
foreach ( Thing item in things )
{
list.Add( item.B.ToString()+item.C.ToString(), item);
}
Now when you do your populate, you will end up with the list sorted by the values of B+C as you requested.
Sometimes you just have to think outside the square to see the rectangle.
|
|
|
|
|
I have a Function that returns searched criteria into an array. Every 6 elements of that array is one record for that customer. I am wanting to parse this data into a listView for better reading. So every 6 elements should be one row for that listView. Below i have this and it gets the first element for each record.
string[] dataArray;
dataArray = uni.ReadList();
length = dataArray.Length;
if (length > 0 && length % 6 == 0)
{
for (i = 0; i < length; i += 6)
{
listView1.Items.Add(dataArray[i]);
}
}
What i am having problems with is adding the other 5 elements to the listview in the other 5 colums.
Could someone help me out please?
Thanks in Advance
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
You need following code.
ListViewItem item = listView1.Items.Add(dataArray[i]);
item.SubItems.Add(dataArray[i+1]);
item.SubItems.Add(dataArray[i+2]);
|
|
|
|
|
for (int i = 0; i < length; i += 6)
{
<code>ListViewItem itm = listView1.Items.Add(dataArray[i]);
for (int i2 = i+1; i2 < i+6; i2 ++)
{
itm.SubItems.Add(dataArray[i2]);
}</code>
}
--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
|
|
|
|
|
I have 4 classes (Class 1-4). Classes 2 and 3 are children of class 1. I need both class 2 and 3 to call on methods from class 4. I've looked at the base method but I can't seem to make it do what I want it to.
I could just make an instance of class 4 in both classes 1 and 2, however I'm trying to avoid it.
Any ideas, or should I just call the two instances of class 4?
Oh, and Class 1 is a static class.
Dave
|
|
|
|
|
Make the instance of class 4 a member of class 1, with protected access, so that class 2 and 3 can access it.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Muntyness wrote: or should I just call the two instances of class 4?
Not possible to answer definitively without more context, but that is a reasonable approach. Another might be a class 1.2 that encapsulates the use of class 4 and then class 2 and 3 derive from class 1.2 rather than from class 1.
led mike
|
|
|
|
|
Can you put class outline, it will make easy to understand what exactly you want....
|
|
|
|
|
M Aamir Maniar: This will probably make you more confused, but....
Static Class 1
|
--> Class 2 + Class 3
then
Class 2 + Class 3
|
---->Class 4 method
So class 1 on creates both class 2 and 3.
Then a method in either 2 or 3 calls a method in 4.
MP (2): Its a static, so it wont let me create a protected instance of class 4.
led mike: You suggestion might work, but I'm going to try to avoid it.
(I only want class 4 as either children of 2 and 3 or a seperate instance from them, because of what it does)
Dave
|
|
|
|
|
Then go with Marilyn Manson's reply
|
|
|
|
|
If class 4 is static, then there is nothing stopping you from using that method.
Assume everything below is all in the same namespace.
public static class Calculator
{
public static int Compute(param obj[] parms){...}
}
public class One
{
Class2 clas2 = new Class2();
Class3 clas3 = new Class3();
....
clas2.Consume();
clas3.Consume();
}
public class Class2
{
public void COnsume()
{
Calculator.Compute(parms);
}
}
public class Class3
{
public void Consume()
{
Calculator.Compute(otherParms);
}
}
|
|
|
|
|
Hi,
How to get the height and width of a window which has a scrollbar both horizontal and vertical.
Thanks
Subramanya
|
|
|
|
|
Subramanyahs wrote: How to get the height and width of a window which has a scrollbar both horizontal and vertical.
The height and width should be the same regardless of what is inside the window. However if you are trying figure the height and width of the inner area just subtract the width of the scrollbars from the window's width and height.
=====Brain melting code=====
static int Sqrt(int x){ if (x<0) throw new ArgumentOutOfRangeException(); int temp, y=0, b=0x8000, bshft=15, v=x; do { if (v>=(temp=(y<<1)+b<<bshft--)) { y+=b; v-=temp; } } while ((b>>=1)>0); return y; :omg:
====TSI TLFL EEOOLHTG=====
^^^^^^^^^^^^^^^^^
Decode that and you will win.;P
============Hint===========
cout << "33 20 57 4F 52 44 53 62 63 6B 77 6F 72 64 73";
|
|
|
|
|
I am new to C# & .Net.
I have an application that have some .exe files. It used to execute with the help of some Dll's. .exe files used to execute only if these dlls and exe files are in the same folder.
The problem is that when i am trying to create a window installer for my application, it used to create all dlls and exe files in program(start) menu. whereas i just wants to have the exe in the program menu, not the dll's. For e.g if we use the setup of winamp or any other application, on clicking the setup, it installs and only exe will be there in the program menu. No supporting files will be there.
hope it may give you an idea of what am i trying to ask....
thanks in advance
Praveen Raghuvanshi
Software Engineer,
Wins Infotek Pvt. LTd.
Technopark, Trivandrum
India.
|
|
|
|
|
Have you looked at Advanced Installer[^]? The basic version also happens to be free and works fine for me.
ChrisB
|
|
|
|
|
thanks chris for the reply.
advanced installer is a paid tool.
can't we do the things using windows installer.
if yes, please tell the procedure.
|
|
|
|
|
The free version of advanced installer works fine for me, but have you looked at the "setup" project type in visual studio?
You need to add a setup project to your solution.
Then you tell it where to install the files (exe, dll) to, then you create "shortcuts" to the exe file(s) in the "start-menu" part.
When you run the setup, it places the files in the folder, and the shortcuts to the files in the start menu.
As I remember it's not too easy to use, but using drag & drop and right click you should be able to use it of.
VS2005 has a "Setup Wizard Progect" to help you. - File > New Project > Other Project Types > Setup & Deployment.
ChrisB
|
|
|
|
|
Thanks again. your reply gave me a way to start.
1 more problem is there. Inside the Desktop and Program menu folder, i have created 2 shortcut for 2 diff exe's. Those 2 exe's have 2 different icons, but with same name. So, when i used to install the setup.exe. it used to create shortcut for the 2 exe's with their icons. In addition to that 1 more icon used to get added in the program menu.
In total there are 4 files in my desktop folder.
2 are exe's and 2 are icon files.
Thanks in advance.
|
|
|
|
|
Could you not set the exe icon property (in the application settings - not part of the setup) to use the specific icon? Then you would not need to include the icon file as part of your setup.
Just a thought.
ChrisB
|
|
|
|
|
Now all the things are working proper.
thanks a lot.
|
|
|
|
|
Hello everybody.
I have a problem.I'm working with VS2005 and my project is a C# windows application. I define an array of buttons but I don't know how to make EventHandler for this array;
Thanks for all.
t_nedelchev
|
|
|
|
|
for (i=0; i < ...) {
btnArr[i].Click += new System.EventHandler(NameOfYourClickHandler);
btnArr[i].Tag = i;
}
Then declare a function called NameOfYourClickHandler:
public void NameOfYourClickHandler(object sender, System.EventArgs e) {
MessageBox.Show(((System.Windows.Button)sender).Tag.ToString());
}
Ut
|
|
|
|
|
Hi all,
Is there a way to say Process.Start("THEFile") and say with what program to open it in?
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
Process oProcess = new Process();
oProcess.StartInfo.Arguments = "D:\\Temp\\MyFile.txt";
oProcess.StartInfo.FileName = "notepad.exe";
oProcess.Start();
--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
|
|
|
|