how to copy from text box to struct C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajithsrao

    how to copy from text box to struct C#

    I need to copy the strings from text box to struct. is there any way to do it? here's what am trying:
    Code:
        public unsafe struct mystruc
        {
            public fixed byte[] install_name[32]; 
            public byte[] fixed install_id[4];limit 4 bytes
            public fixed byte[] model_name[6]; limit 4 bytes
        };
    
        private void write_b_Click(object sender, EventArgs e)
        {
            mystruc mstruc1 = new mystruc();
    
            //copy from textbox to struct    
    mstruc.install_name =Encoding.UTF8.GetBytes(installation_name_tb.Text);
     
    mstruc.install_id =Encoding.UTF8.GetBytes(installation_id_tb.Text);
            mstruc.model_name = Encoding.UTF8.GetBytes(model_tb.Text);    
        }
    and also other way round. its not working.. :( any help greatly appreciated
Working...