|
hakerf***er wrote: THAT WAS SMART
Thank you!
hakerf***er wrote: i GUESS U R THE ONE WHO DID EVRYTHING DURING ALL THE SIMSTER... F***FACE!!!
As a matter of fact, yes!
/ravi
|
|
|
|
|
I am using DataView in C#.
Lets say I have a column [Dataset ID]
How can I filter the column, it doesn't accept for example:
RowFilter = "[Dataset ID]=5"
I mean if the column name is not one word.
Thanks,
Clint
|
|
|
|
|
clint1982 wrote: Lets say I have a column [Dataset ID]
I would rather look at the System.Data.DataColumn.ColumnName property of that column.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hello everybody,
I have to D&D a Label into a DataGrid, which is styled like a Calendar and don`t know how to get the Icon - related to the Label - into the right row of the DataGrid. I have to use .NET Framework 1.1 and VS2003 for my Project.
Now you know my problem. I hope anybody can help
________________________________________________________________
The only true wisdom is in knowing you know nothing. - Socrates
|
|
|
|
|
Where exactly is the problem? Is is that you are not able to resolve the row/column from the mouse position? If yes than have a loog at the HitTest function of the DataGrid.
|
|
|
|
|
thanks, that's right.
i cannot get the icon into the row. I tried the hittest function but i did not find any samples to see how to code it. Since I'm a student to pogramming, i don't know many things...
_______________________________________________________________
The only true wisdom is in knowing you know nothing. - Socrates
|
|
|
|
|
Basically you have to implement your own DataGridColumnStyle. It defines how columns are rendered and edited. This article[^] might be of help for you.
|
|
|
|
|
Hi how can i write all the values of ArrayList into a text box. i.e one object on each line of textBox
Regards
|
|
|
|
|
If you want one value on each line would a listbox be a better choice?
|
|
|
|
|
well i ve to write this in a textbox u can say that its a requirement.. now m using textBox.Lines statement to assign the values from an array of strings but this doesnt work with arraylist.......
so how can i do that ??
Regards
|
|
|
|
|
I.e like this:
ArrayList myList = new ArrayList();
fillArrayList(this.myList);
string [] listAsString = new string [myList.Count];
for(int i = 0; i < myList.Count; i++)
listAsString [i] = myList[i].ToString();
textBox.Lines = listAsString ;
-Larantz-
|
|
|
|
|
I would recommend listbox aswell because a listbox is dynamic, so if your ArrayList containts 10 or 100 items, it won't matter. A textbox will be filled up and you'd have to resize it manually to fit the contents.
ListBox foo = new ListBox();
ArrayList bar = new ArrayList();
fillArrayList(bar);
foreach(object obj in bar)
foo.Items.Add(obj);
If you know the objecttype in the ArrayList you can cast it like: "foo.Items.Add((myObject)obj);"
But unless the object has a ToString() method that produces something intelligent, the text added to your textbox will only be the type of the object. Like if you added a custom object called myObject, thats within the namespace myNamespace, the text you'd see in the listbox pr item would be "myNamespace.myObject".
If the ArrayList is filled with string-items you could use "foo.Items.Add(obj.ToString());"
-Larantz-
|
|
|
|
|
Thxx sir i ll try to use this
Regards,
|
|
|
|
|
Thx Sir, i have used list box as u have advised but the problem now is that i am actually displaying a file list from a folder wich is browsed by the user. so when the user browses for the next time the previous files also get displayed with it ..
and i didnt find any property to reset the listBox so wat will be its solution
Regards
|
|
|
|
|
|
how easy it was and i just kept on looking in the methods and properties of listBox
anyways thanks its working fine
Regards
|
|
|
|
|
I am trying to see if an Item already exists in a list view so I tried the following:
if (!lvDisk.Items.ContainsKey(fi[i].ToString()))
{
ListViewItem lvItem = new ListViewItem(fi[i].ToString());
lvItem.SubItems.Add("New");
lvItem.SubItems.Add(fi[i].LastAccessTime.ToShortDateString());
lvCD_DVD.Items.Add(lvItem);
}
else
{
ListViewItem lvItem = new ListViewItem(fi[i].ToString());
lvItem.SubItems.Add(fi[i].LastAccessTime.ToShortDateString());
lvItem.SubItems.Add("Already Exists");
lvCD_DVD.Items.Add(lvItem);
}
But I would always get the NEW status, so I tried to see what was going on. When I did a lvDisk.Items.GetType() I got System.Windows.Form.ListView+ListViewItemsCollection.
Can any one help me with this problem?
|
|
|
|
|
How do you add the items to the listview?
like lvDisk.Items.Add(someObject);
or lvDisk.Items.Add(someObject.ToString());?
-Larantz-
|
|
|
|
|
Like this:
ListViewItem lvItem = new ListViewItem(fi[i].ToString());
lvItem.SubItems.Add(fi[i].LastAccessTime.ToShortDateString());
lvDisk.Items.Add(lvItem);
|
|
|
|
|
Dear Friends,
assume the following namespace:
namespace MyNameSpace
{
public struct MyStruct
{
private int intVar;
public int IntVar
{
get { return intVar; }
set { intVar = value; }
}
}
public class MyClass
{
private MyStruct structVar;
public MyStruct StructVar
{
get { return structVar; }
set { structVar = value; }
}
public MyClass()
{
}
}
}
}
This class is in a dll file (MyAssembly.dll).I wanna load this dll at runtime by reflection and change the IntVar property of StructVar of my class instance by SetValue method of PropertyInfo class.
namespace MyApplication
{
public class MainClass
{
public void ChangeProperty()
{
Assembly asm = Assembly.LoadFrom("MyAssembly.dll");
Type t = asm.GetType("MyNamespace.MyClass");
PropertyInfo pInfo = t.GetProperty("StructVar");
<font color="red">
</font>
pInfo.SetValue(???);
}
}
}
Note that this class is in a seperate dll.
Best Regards.
[ _ Always there is another way _ ]
|
|
|
|
|
First create an instance of your class using Activator . Then you should be able to access your structure as usual.
Example:
<br />
Type t = asm.GetType("MyNamespace.MyClass");<br />
MyNamespace.MyClass cls = Activator.CreateInstance(t);<br />
cls.StructVar.IntVar = 4;<br />
|
|
|
|
|
Deart Rudy.
Thanx for your attention.But MyNamespace.MyClass is in a separate dll file and I haven't it at compile time.If I write this code I will receive the following error :
The type or namespace name 'MyNamespace' could not be found (are you missing a using directive or an assembly reference?)
Everything is at Runtime
[ _ Always there is another way _ ]
|
|
|
|
|
This should do the trick:
Assembly asm = Assembly.LoadFrom("MyAssembly.dll");
Type t = asm.GetType("MyNamespace.MyClass");
Object obj = Activator.CreateInstance(t);
PropertyInfo pInfo = t.GetProperty("StructVar");
PropertyInfo pInfo2 = pInfo.PropertyType.GetProperty("IntVar");
pInfo2.SetValue(1, pInfo.GetValue(obj, null), null);
"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
-- modified at 13:33 Sunday 7th May, 2006
|
|
|
|
|
Stefan Troschütz wrote: pInfo2.SetValue(1, pInfo.GetValue(obj, null), null);
That won't work, pInfo.GetValue(...) will return a boxed instance of the struct, so setting it's IntVar property won't affect the original struct. As I suggested in my post below, you can call pInfo.SetValue to set the new struct, but I wonder if there's a better way? Maybe an API function to get the struct by reference? Or is this what the compiler does when you call myClass.StructVar.IntVar = 2 ?
Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
|
|
|
|
|
Ups, I didn't thought so far and the code snippet was a quick, untested shot Thanks for the correction.
Currently no solution comes to my mind, that's better than yours. Would be interesting to dig a bit deeper into this, when having more time than now.
"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
|
|
|
|