473,508 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to copy from text box to struct C#

1 New Member
I need to copy the strings from text box to struct. is there any way to do it? here's what am trying:
Expand|Select|Wrap|Line Numbers
  1. public unsafe struct mystruc
  2. {
  3.     public byte[] install_name; // size limit 32 bytes
  4.     public byte[] install_id;   // size limit 4 bytes
  5.     public byte[] model_name;   // size limit 4 bytes
  6. };
  7.  
  8. private void read_b_Click(object sender, EventArgs e)
  9. {
  10.     mystruc mstruc1 = new mystruc();
  11.  
  12.     //copy from textbox to struct    
  13.     mstruc.install_name = Encoding.UTF8.GetBytes(installation_name_tb.Text);
  14.     mstruc.install_id = Encoding.UTF8.GetBytes(installation_id_tb.Text);
  15.     mstruc.model_name = Encoding.UTF8.GetBytes(model_tb.Text);    
  16. }
  17.  
and also other way round. its not working.. :( any help greatly appreciated
Oct 29 '10 #1
2 1268
GaryTexmo
1,501 Recognized Expert Top Contributor
Note, I reported the other one, you got a duplicate post. Lets keep this one :)
Oct 29 '10 #2
GaryTexmo
1,501 Recognized Expert Top Contributor
Can you describe how it's not working? I just plugged your code in and does indeed work for me. Please be a bit more descriptive in what the problem is, and the result you're looking for.

Thanks!
Oct 29 '10 #3

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

Similar topics

0
2559
by: Meikel | last post by:
I created a ClipboardUtils class which makes it easy to copy Strings or images to the clipboard. I don't claim that it's no way perfect, but has been useful in my applications so far. If you try...
0
1191
by: DL | last post by:
Can somebody tell met how to copy text from a control item to a textbox by pressing a button. control item is in this case a pdf document. ( don't know if you name it like this but it sounds...
5
1815
by: Dave Vick | last post by:
OK, I've got a requirment to copy some content from an HTML page. It is a failry lengthy page and we want to give the user/reader the ability to click a button and have a section of the page copied...
3
2131
by: worzel | last post by:
need some simple code to copy text to clipboard in c# - my app has right click > copy to clicpboard feature, which is best way to do this?
9
26469
by: Michael | last post by:
Hi all, I want to copy a structure, but the only thing I have is a pointer to it. Whats good here? Because the structure contains no pointers, but arrays and variables I thought of doing a...
2
1523
by: Jay | last post by:
Is there a way to copy text that is always in the same place in a word document, (such as an id number in my case) and then paste it into a text box in another program? I've tried various...
1
3609
by: Miljana Murgas | last post by:
I have a struct like this: public struct Vec { public float m; public Vec(float v1, float v2) { m = new float; m=v1; m=v2; }
1
3061
by: onlivimal | last post by:
hi, i have a problem copying two struct data. struct Details { public: char Title; char Artist; int noSongs; float Price; ...
10
3321
by: Sillu | last post by:
I'ld like to create a web page, from which no one can select the text simply, copy frm there n paste at another location. In simple means, i'ld like to stop copy process from my web page. Plz...
0
1971
by: Robert | last post by:
Hi! I want to fill the clipboard programmatically in oder to manual copy the data to word. The data consists of cells of a grid which contains text or images. Using the standard copy/paste of...
0
7224
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
7120
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
7323
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
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7494
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...
0
5626
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,...
1
5050
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...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.