|
Hi Gopal.S
Thanks for your suggestion. I am just figure out how to do it, but seem you have a better suggestion
1) I just simple Concatnate the columns after i get the dataset, something like below:
string s = dsTemp.Tables[0].Rows[1][2].ToString() + dsTemp.Tables[0].Rows[1][3].ToString();
2) I am using CellEndEdit ,as below;
this.dataGridView1.CellEndEdit += new DataGridViewCellEventHandler(dataGridView1_CellEndEdit);
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
string cellvalue;
if (e.ColumnIndex == 1)
{
cellvalue = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
if (cellvalue != null && cellvalue != "")
{
}
}
I will try you suggestion too, Thanks 
|
|
|
|
|
Member Function Pointers usage on class instances:
Class A is derived from Class ZZZ. Class A has a member function A::ftnOnA
Class B is derived from Class YYY.
Class A instantiates Class B
Could Class A pass a member function pointer to Class B and then Class B be able to call A::ftnOnA? (Like a call back procedure)
Can anyone please help me?
|
|
|
|
|
You can set up a delegate to achieve this.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello all! I have a college project due tomorrow and I am in dire need of some assistance! The project requires that I create a plain windows form with six controls on it; I have chosen six buttons. Form2 will be the startup form, will have a combobox and a DataGridView (I am using a richTextBox right now, but will change that once the rest works). The names of the controls from Form1 populate the combobox in Form2. By selecting one of the controls from the combobox, all of that controls' properties are then listed in the DataGridView.
I have most of it working, but I cannot get the value for each property using the GetValue(object, object[] index) method. I have tried all that I can think of, but cannot get it to work. The code that I have for Form2 is as follows:
Here, the main problem is on the bottom line of code. I have commented there.
public partial class Form2 : Form
{
//Declares an Array of type Controls:
Control[] controls;
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
//Creates an instance of Form1:
Form1 myForm = new Form1();
//Initializes the Control[] by calling the getControls() method on Form1:
controls = myForm.getControls();
//Adds the Control names to the ComboBox:
foreach (Control c in controls)
{
myCboBox.Items.Add(c.Name);
}
}
private void myCboBox_SelectedIndexChanged(object sender, EventArgs e)
{
//creates an int to hold the selected index:
int index = myCboBox.SelectedIndex;
//creates a type variable:
Type t = controls[index].GetType();
//clears any previous entries:
richTextBox1.Clear();
foreach (PropertyInfo prop in t.GetProperties())
{
//Here, the GetValue method will not work! I have tried passing everything that I can think of to it
//and still it will not work. It keeps telling me that target object does not match.
//Please help.
richTextBox1.Text += "\n" +
prop.Name + "\t\t:" + prop.GetValue(t, null);
}
}
}
"If you don't know where you're going, you'll probably end up somewhere else." Yogi Berra
|
|
|
|
|
Perhaps the first form should have a public property that yields a list of the names of the controls?
|
|
|
|
|
The first form does. It has an array of Controls that are populated by the Controls that are on it. There is a method, GetControls() that returns the array of Controls. Form2 then loops through that array and populates the comboboxlike so:
foreach (Control c in controls)
{
comboBox1.Items.Add(c.Name);
}
I know that this is working because when the code is ran, if you take away the faulty attempt to call the GetValue(object, object[] index) method, all of the property names are properly displayed in the richTextBox.
I need to know the proper way to call the GetValue(object, object[] index) method to get the property values, given the way that I am going about the logic.
Thanks.
"If you don't know where you're going, you'll probably end up somewhere else." Yogi Berra
|
|
|
|
|
MrColeyted wrote: richTextBox1.Text += "\n" +
prop.Name + "\t\t:" + prop.GetValue(t, null);
You are trying to find the property value from the type, you have tried to get it from the object itself
richTextBox1.Text += "\n" +
prop.Name + "\t\t:" + prop.GetValue(controls[index], null);
*jaans
|
|
|
|
|
My friend, I could kiss you! Thank you so very much. That did it!
"If you don't know where you're going, you'll probably end up somewhere else." Yogi Berra
|
|
|
|
|
Hello all,
I am looking for a program that will generate C# classes from a xsd schema.
A. I need it to be able to generate separate .cs files for the schemas that are are imported.
B. I need it to generate partial classes and would like it to generate generic collections.
C. I need it to be a free, downloadable program.
I have looked at the following tools:
1. xsd.exe - Does not generate multiple files.
2. XSDObjectGen - Does generate multiple files (given that the schemas have different namespaces), will generate partial classes, but it uses ArrayLists for it's collections (if it's 2.0 aware, why on earth would it generate ArrayLists?).
3. XSDClassGen - Does generate Generic collections, but does not generate multiple files.
4. CodeXS - Is an internet only tool.
Thanks in advance.
|
|
|
|
|
I found another one that doesn't do what I want.
It's called 'Dingo'. The author claimed that it's highly extensible.
When I tried to compile the classes it generated, they didn't compile.
It also doesn't generate partial classes unless you write a plugin for it.
|
|
|
|
|
Hello CBadal,
Do you have any luck on generating .cs files for the schemas that are imported.
If so can you please help me how to do.
Please assist me.
Thanks,
Sri
|
|
|
|
|
I want to build an application in windows forms to run another program which is console base program. how can i open my console program passing parameter to cmd and my console program have also some parameters.
|
|
|
|
|
The main method of your application will receive the parameters. You can use the Process object to send and receive commands. Also you can use MSMQ.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
sorry search through anywhere but i did't find my solution.
plz help me out.
|
|
|
|
|
Hi,
here are some facts:
1.
every process starts executing some kind of main method or function.
Under .NET the static main() method optionally gets as a parameter a string[] args array
holding the command line parameters.
You can make your app such that it reads that string array, and acts accordingly
(e.g. opens the file or files for which it gets paths).
2.
You can get the same information by using Environment.CommandLine or Environment.GetCommandLineArgs()
3.
You can provide command line arguments in many ways:
- by typing a command in a "DOS Window" (or the "Run" menu under the Start button);
- by having a command line in a batch file (extension .bat) which you execute by double-clicking;
- by adding them to the "Target" field of a desktop shortcut.
4.
Tou can programmatically launch another process and provide a command line while doing so;
it takes the Process class; either use Process.Start method, or instantiate a Process object,
set its StartInfo property, then Start() it.
Have a look at the documentation for all items mentioned!
|
|
|
|
|
Hi,
I need help on transfering data between forms. I am building a chat aplication and i am little stuck\stoped on transfering data between the Main_Chat_Form and the Private_Chat_Form
Well i have this:
(Its one exemple, can be a textbox or other stuff)
//In Form1.cs
private Form2 otherForm = new Form2();
private void GetOtherFormTextBox()
{
textBox1.Text = otherForm.TextBox1.Text;
}
//In Form2.cs:
public TextBox TextBox1
{
get
{
return textBox1;
}
}
But... it reads\gets the variable initial values. Even when a change the variable values it gets the initial ones.
(I think that i maneged to solve this one time with classes)
Can anyone help me on this?
Thank you!!!
|
|
|
|
|
First of all, please assure me that you don't really use these variable names ?
You should use delegates to pass info between forms, an excellent article exists on this, right here on CP.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You can use static member field of one form,the variable which to be passed to another form from one to other.
|
|
|
|
|
you can, but it's nasty, ugly, a hack, and it breaks if you need more than one instance of a form.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi
you want to transfering date between froms. i think you familiar with Visual Basic 6.0 or Visual Basic.Net.
but currently you work in C#.
C# not like a Visual Basic.Net. it's too different.
Inheritance will help your problem.
so you imporve yours OOP concepts. then try it.
|
|
|
|
|
Hi again,
I found many solutions to my problem. However i would like (if possible) to use a 3º "object" to negociate between|with form1 and form2.
I d´ont like to code in both forms.cs, i would like to code in one class.cs to deal with both.
I thinking in store the variables values in a class.cs(other file).
---I want to code (part of) that process in a independent cs file
---write variable from form1 to class.cs file, and call variable from class.cs file to form2
I already solved it ... well found the solution... well just trying to get other solution more elegant!!!
Thank you!!!!
|
|
|
|
|
Hi there,
Where to put additional task in the setup project
In other word : where to put the code that add a file , or add a registry key ( I know how to do it but I do not know where!)
I hope I made it clear
Thanks in advance
There is always something to learn
|
|
|
|
|
How are you creating your setup project ? I know if you use a tool like Advanced Installer, you can do that stuff, but not sure how much of the msi functionality VS exposes ( I've never used VS to create an MSI )
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
What I wanted to do is:
to add some additional code to the setup , that perform some tasks during the installation of the application ,
I created the setup project as simple as possible , added from project template and then I added the primary output of the application
thanks
There is always something to learn
|
|
|
|
|
OK - I reiterate, I think the Visual Studio msis are a bit limited, try a tool like Advanced Installer.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|