|
cool.. u got 5 from me..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Thanks!!!!!!!!!!!!!!!!!!!!!
thank you so much!!!
|
|
|
|
|
Hi All
I am using PropertyGrid to show the properties of object..
want to use property grid with combo box and taking help from this MSDN link..
http://msdn2.microsoft.com/en-us/library/aa302326.aspx
here is the code that I am using..
<br />
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.ComponentModel;<br />
<br />
namespace PropertyGridTest<br />
{<br />
[DefaultPropertyAttribute("Person")]<br />
class Person : StringConverter<br />
{<br />
public Person(string inName, string inAddress, int inAge, bool inEmployed)<br />
{<br />
name = inName ;<br />
address = inAddress ;<br />
age = inAge ;<br />
employed = inEmployed;<br />
}<br />
<br />
<br />
public Person(string inName)<br />
{<br />
name = inName;<br />
}<br />
<br />
<br />
private string name;<br />
private string address;<br />
private int age;<br />
private bool employed;<br />
<br />
<br />
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)<br />
{<br />
return true;<br />
}<br />
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)<br />
{<br />
return true;<br />
}<br />
<br />
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)<br />
{<br />
return new StandardValuesCollection(new string [] {"AAA", "BBB", "CCC", "DDD" });<br />
<br />
}<br />
<br />
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)<br />
{<br />
return false;<br />
}<br />
<br />
<br />
<br />
[TypeConverter(typeof(Person)), <br />
CategoryAttribute("Person Details"), DescriptionAttribute("Name of the Person")]<br />
public string Name<br />
{<br />
get<br />
{<br />
return name;<br />
}<br />
set<br />
{<br />
name = value;<br />
}<br />
}<br />
<br />
[CategoryAttribute("Person Details"), DescriptionAttribute("Address of the Person")]<br />
public string Address<br />
{<br />
get<br />
{<br />
return address;<br />
}<br />
set<br />
{<br />
address = value;<br />
}<br />
}<br />
<br />
[CategoryAttribute("Person Details"), DescriptionAttribute("Employed")]<br />
public bool IsEmployed<br />
{<br />
get<br />
{<br />
return employed;<br />
}<br />
set<br />
{<br />
employed = value;<br />
}<br />
}<br />
<br />
<br />
[CategoryAttribute("Person Details"),<br />
DescriptionAttribute("Age of the Person")]<br />
public int Age<br />
{<br />
get<br />
{<br />
return age;<br />
}<br />
set<br />
{<br />
age = value;<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
and
<br />
<br />
private void radioButton1_CheckedChanged(object sender, EventArgs e)<br />
{<br />
if (radioButton1.Checked)<br />
{<br />
try<br />
{<br />
Person person = new Person("John", "CA", 5, false);<br />
propertyGrid1.SelectedObject = person;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
<br />
Now when i run the application then a exception is caught and the message is "Constructor on type PropertyGridTest.Person not found" is popped up,
also "Name" property is disabled.
Please help me to solve this problem..
that is how to show combobox in propertyGrid.
Please help me.
Thanks & Regards
|
|
|
|
|
rajeevktripathi wrote: Person : StringConverter
Your class should not derive from a TypeConverter, rather use the TypeConverter attribute to decorate the 'Person' class.
|
|
|
|
|
HI Thanks for your reply...
Please tell me that how to decorate Person class from TypeConverter attribute
but in the MSDN link learened that I have to derive my class from the TypeConverter ...
So PLease help me in resolving the problem...
Thanks & Regards
|
|
|
|
|
I have a very basic question.
If I declare some variables in my class and just run my C#.Net program, without any work done in it, will it allocate a memory for these variables?
For Example,
Class abc
{
public int a;
public double b;
}
Regards,
Anil
|
|
|
|
|
yes - when an instance of the class is created
|
|
|
|
|
Does that mean, when we include say System.Data.SQLClient namespace on the top of our class, it copies all the classes inside this namespace at runtime and allocates memory accordingly even if we don't use anything in it?
Regards,
Anil
|
|
|
|
|
no not when including the namespaces/classes, when instantiating them
|
|
|
|
|
A M SOMAN wrote: Does that mean, when we include say System.Data.SQLClient namespace on the top of our class, it copies all the classes inside this namespace at runtime and allocates memory accordingly
It will allocate memory once you create instance for it. class1 c1; won't allocate any memory. But class1 c1 = new class1() will allocate memory space.
|
|
|
|
|
|
Yes, it is possible. Use System.Runtime.Remoting
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
But How. Is there any codding sample for this type of Idea???
Naresh Patel
|
|
|
|
|
Yeah, there is more code samples than you can shake a stick at. Google it, C# remoting.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
|
I have ListView and i need to know the item that seleceted in event - how to do it ?
|
|
|
|
|
lv.SelectedItems();
or
lv.SelectedIndices();
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Have a look at SelectedItems property.
|
|
|
|
|
hi all
i creeat solution by type setup and deployment
but my application connect to database in sql server2005 and i wount to put the database in my instolation solution
how i can do that
thanks to all
Thaer
|
|
|
|
|
Execute the create script for your db when the installation runs.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thanks Mr Justin Perez
I do it but the instolation feilds and give me this message
DataBase creation fault
Aconnection was Successfully established with the Server ,but then an error occured during the login Process (provider :Shared Memory Provider , error -N Process is on the other end of the pipe.)
what is the problem and how i can solve it
thanks for you Mr Justin Perez
Thaer
|
|
|
|
|
The problem is that the user account you were using on your development machine doesn't exist on your target machine. Set up that same account for that DB on the machine you are installing to and that should take care of the issue.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
hi guys,
how can I user rexec in c#
I want to access my linux machine ?
if you have any free dll that do this job for me
my code
<br />
Process p = new Process();<br />
<br />
p.StartInfo.UseShellExecute = false;<br />
p.StartInfo.RedirectStandardInput = true;<br />
p.StartInfo.RedirectStandardOutput = true;<br />
<br />
<br />
p.StartInfo.FileName = "rexec lnx5e048 -l subaaa0p \"setenv DISPLAY :0 ;ls -al\"";<br />
<br />
StreamReader myStreamReader = p.StandardOutput;<br />
Console.WriteLine(myStreamReader.ReadToEnd());<br />
please help
|
|
|
|
|
How are you trying to access your Linux machine? Is rexec a program on your Linux machine? If so, you will not be able to run it from Windows because the executables are different.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I can user rexec in windows to access virtual Linux desktop and execute my linxs application from throw this virtual desktop.
I can access it simply if I use command DOS :\ --> (rexec hostName -l Username "command")
how can I do it in C#
Do I have to use Process class? if yes how ??
|
|
|
|