473,466 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Getting values throw dynamically created winfom

A I'm new to c# and I came from c++ also.
I want to create dynamicaly winform to get some data. I create a array
of object as a description of variable which I want to get. I pass this
array to a function which build a form, show the edit fields and return
changed values. Changed values are stored in my array of objects but
these original values are not changed.

Short code snipet ( this is working)
// ---- c# ----
struct desc {
object o;
enum otype t;
}
int i;
string s;
// I want to get new values for i and s;
desc o1 = new desc( i, t_int );
desc o2 = new desc(s, t_str );

desc [] d = new desc[] { o1, o2 };

get_value( d ); // this methode create winform, with dynamic contents,
get the data, and return a values.

// and now I need to:
i = (int)o1.o; // I want to skip these two lines
s=(string)o2.o;
//--------------------------------------------
In c++ I can do this like:
struct desc {
object o;
enum otype t;
}
int i;
string s;
desc d[] = { {&i, t_int}, {&s, t_str}};
get_value( d ); // this methode create winform, with dynamic contents,
get the data, and return a values.
// and at the end the original values are changed
//-------------------------------------------------

Is this possible to simplify c# solution? I want to ommit last two
asignments.

MiSo

May 24 '06 #1
2 1477
In order to pass parameter as reference type you need to use ref keyword for
example:
get_value(ref d);

chanmm
<so****@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
A I'm new to c# and I came from c++ also.
I want to create dynamicaly winform to get some data. I create a array
of object as a description of variable which I want to get. I pass this
array to a function which build a form, show the edit fields and return
changed values. Changed values are stored in my array of objects but
these original values are not changed.

Short code snipet ( this is working)
// ---- c# ----
struct desc {
object o;
enum otype t;
}
int i;
string s;
// I want to get new values for i and s;
desc o1 = new desc( i, t_int );
desc o2 = new desc(s, t_str );

desc [] d = new desc[] { o1, o2 };

get_value( d ); // this methode create winform, with dynamic contents,
get the data, and return a values.

// and now I need to:
i = (int)o1.o; // I want to skip these two lines
s=(string)o2.o;
//--------------------------------------------
In c++ I can do this like:
struct desc {
object o;
enum otype t;
}
int i;
string s;
desc d[] = { {&i, t_int}, {&s, t_str}};
get_value( d ); // this methode create winform, with dynamic contents,
get the data, and return a values.
// and at the end the original values are changed
//-------------------------------------------------

Is this possible to simplify c# solution? I want to ommit last two
asignments.

MiSo

May 25 '06 #2
I've tried this, but it doesn't help me.
Like you can see, I want to first store set of variables in array and
then call get_value( d)
d array is a object and is referenced automaticaly.
I can't change values of int and string.

MiSo

May 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Martin | last post by:
There seems to be some strange behaviour when trying to get the scrollHeight and scrollTop of an iframe in IE6. I have tried several ways of getting these values when the iframe is written into...
2
by: Colin McGuigan | last post by:
This is a translation of an ASP page to ASP.Net. First, the background: The goal is to have a grid of different settings for the application -- think something along the lines of the Property...
3
by: Jen | last post by:
Hi I have created some controls (HtmlInputText, HtmlGenericControl, TextBox) dynamically. But I have problem getting the values from these controls to save them. Is there a way to do that? ...
4
by: Mark Broadbent | last post by:
This one has got me absolutely stumped. At work I have created a simple web form that gets data from a sql backend and puts this to a dataset. I have an edit button that when clicked will set...
14
by: dcassar | last post by:
I have had a lively discussion with some coworkers and decided to get some general feedback on an issue that I could find very little guidance on. Why is it considered bad practice to define a...
0
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) :...
3
by: somaskarthic | last post by:
Hi How to get the values of dynamically created checkboxes which are checked and unchecked (for both the conditions). Only the selected checkbox values are posted as 'On' . How can i get the value...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
2
by: RSH | last post by:
Hi, I have a CheckBoxList that is dynamically created in the codebehind. When I click the submit button on the form I am handling the click event but I cant get at the checked values of the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.