473,395 Members | 1,443 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,395 software developers and data experts.

C# Create a new array from 2 existing arrays

I have a method where I would like to fill texboxes with a code dependant on options selected from 5 dropdownlists.

Each of the ddls has options 1-5 these are stored in wgselect, wghidden stores the string code assigned to each ddl. If option 3 is selected on ddl selCooker then i need 3 textboxes to be filled with string 77. If selFridge option 1 is slected at the same time then 78 needs to be added to textbox 4.

Any idea how to achieve this?

Is the code i have below - so far I can only fill all 5 boxes with the code associated with the last option selected.

Expand|Select|Wrap|Line Numbers
  1. protected void button1_Click(object sender, EventArgs e)
  2.     {
  3.         DropDownList[] wgselect = { selCooker, selFridge, selDryer, selDishwasher, selTV };
  4.                 string[] wghidden = {"77","78","79","80","81"};
  5.         string[] wgcodes = new string[5];
  6.  
  7.         int wgsel = wgselect.Length;
  8.                int i = 0;
  9.                 int u = 0;
  10.                    for (; i < wgsel; i++)
  11.         {
  12.             if (wgselect[i].SelectedItem.Value != "")
  13.             {
  14.  
  15.               u = u+i
  16.             }
  17.             wgcodes[0] = wghidden[u];
  18.             wgcodes[1] = wghidden[u];
  19.             wgcodes[2] = wghidden[u];
  20.             wgcodes[3] = wghidden[u];
  21.             wgcodes[4] = wghidden[u];
  22.  
  23.         }
  24.  
  25.         dfh1.Text = wgcodes[0];
  26.         dfh2.Text = wgcodes[1];
  27.         dfh3.Text = wgcodes[2];
  28.         dfh4.Text = wgcodes[3];
  29.         dfh5.Text = wgcodes[4];
  30.  
  31. 'some other code..
  32.  
  33.  
Aug 9 '07 #1
0 878

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

Similar topics

11
by: Laphan | last post by:
Hi All I'm using .getRows() with a local var array instead of doing a recursive loop so that I'm being a good ASP newvbie and closing my object i/o's (the recordset in this case) as quick as...
4
by: Ney André de Mello Zunino | last post by:
Hello. I have a question regarding arrays when used as arguments in function calls. In a situation like the following: void foo(int array) { // ... }
20
by: K.M. Jr. | last post by:
Hi all, Consider this line - char s = "\0"; Does this initialize all array elements to zero ? Thanks.
7
by: simkn | last post by:
Hello, I'm writing a function that updates an array. That is, given an array, change each element. The trick is this: I can't change any elements until I've processed the entire array. For...
3
by: Lars Grobe | last post by:
Hi, first hello, I am new to the list, and I guess my question will show that clearly. I want to use some vector operations (at the moment altivec) in existing code. It is a raytracing-based...
10
by: | last post by:
I'm fairly new to ASP and must admit its proving a lot more unnecessarily complicated than the other languages I know. I feel this is because there aren't many good official resources out there to...
272
by: Peter Olcott | last post by:
http://groups.google.com/group/comp.lang.c++/msg/a9092f0f6c9bf13a I think that the operator() member function does not work correctly, does anyone else know how to make a template for making two...
57
by: buuuuuum | last post by:
why array can't be assigned, like structs?
7
by: lovecreatesbea... | last post by:
Is it always legal to cast expressions of type of multi-dimension array to type of pointer? Including: T to T* , T to T* , T to T* , and so on... For example: int *mtxrot1d(int *p,...
9
by: Slain | last post by:
I need to convert a an array to a multidimensional one. Since I need to wrok with existing code, I need to modify a declaration which looks like this In the .h file int *x; in a initialize...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.