473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

How to pass a UI from one form to anthor form?

LittleDong
How to pass a form's UI to anthor form?
such as a ComboBox or TextBox.

plus how to pass mixed controls i.e. ComboBox & Label & TextBox ?
use Dictionary<Controls>
or declare a public form.control variable
Mar 8 '12 #1
2 1905
PsychoCoder
465 Expert Mod 256MB
I'm sorry but I'm not sure I understand what you're trying to do, can you provide more info/better explanation of what you're looking to do.
Mar 8 '12 #2
@PsychoCoder
Hi PsychoCoder,

Anyway thanks for your reply.
my question is:
I'm currently developing under Windows Moblie system.

There are two WinForms. One is called "Setting" Form and anthor is "ShowList" Form.
Setting Form has
a ComboBox for user to choose a GPS MeasureMethod,
a CheckBox indicates whether he/she is a superuser,
a Textbox stores user's name,
and a Next Button.

ShowList Form has
a ListView with three columns
[username, MeasureMethod,authority ].

The workflow is the user first set all controls in Setting Form. then click the "Next" Button to show ShowList Form.
The ShowList Form will automatically add usename, GPS MeasureMethod and authority to the ListView.


Code are:
First, I define a public GetSettingValue in Common.cs

Expand|Select|Wrap|Line Numbers
  1. public class Common
  2. {
  3.  .....
  4. public static string[] m_setInfo = new string[3];
  5.   public static void GetSettingValue(TextBox tbx, ComboBox cbx, CheckBox Ckx)
  6. {
  7.  
  8.    setInfo[0]= serName;
  9.    setInfo[1]= cbx.Text;
  10.    setInfo[2]= ckx.Checked.ToString();
  11.    return setInfo
  12. }
  13. .....
  14. }
  15.  

then, get the seting infomation in Setting.cs
Expand|Select|Wrap|Line Numbers
  1. public partial class  Setting : Form
  2. {
  3. ....
  4. private void Next_Click(object sender, EventArgs e)
  5. {
  6.  Common.GetSettingValue((TextBox1,ComboBox1,CheckBox1));
  7. }
  8. ....
  9. }
  10.  
third,show the seting infomation in ShowList.cs
Expand|Select|Wrap|Line Numbers
  1. public partial class  ShowList: Form
  2. {
  3. ....
  4. private void ShowList_Click(object sender, EventArgs e)
  5. {
  6. .......
  7.  
  8.    int loopi = listItems.Count;
  9.    string rowValue = new string { Common.m_setInfo[0],Common.m_setInfo[1],Common.m_setInfo[2] };
  10.   ListViewItem item = new ListViewItem(rowValue);
  11.    listtoAdd.Items.Add(item);
  12. .............       
  13.  
  14. }
  15. ....
  16. }
  17.  
althrough the way can get the thing done
but I think it's not convenient.
so I'm wondering whether there is a better way or a design pattern to implement the function that I want.
Mar 8 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
1
by: mhawkins19 | last post by:
I have a form built and on the onclick event I validate all of the fields and then if the form is ok, on the submit event I run a javascript function to set a cookie and download a file from the...
10
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
4
by: Omar Llanos | last post by:
Recently, I posted a question on how to invoke a textbox control in Form1 (parent form) from within Form2 (which is inherited from Form1). Someone suggested to pass a reference of the Form1 to the...
3
by: fh1996 | last post by:
Form.Owner and Form.Parent, what's the difference between them? Form.ShowDialog() and Form.Show(), when to use which? Form.Activated(), what does it mean when saying a Form is "activated"? ...
3
by: Hei | last post by:
hi, how to pass data cross form? my situation: webFormA for input data, after submit, show webFormB to display report use crystalreport. i just need pass record id for set...
21
by: Just Me | last post by:
I've tried in a few places using a variable name Form and it appears to be OK. For example: Public Shared Sub WritePositionsInRegistry(ByVal Form As Form, ByVal SubkeyName As String) Is it OK...
4
by: Bremanand | last post by:
Hi..Am doing Retailer software using VB 6.0 with ms-access.. Actually i have many form(sales entry form,purchase entry form ,stock form, etc..) in my project which all are in MDI except Log in...
3
by: kate2272 | last post by:
Hi Guys I was wondering if it is possible to turn AllowEdits to false after data has been entered for individual fields within a form/sub-form. I've found that I can do this in the 'AfterUpDate'...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.