Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

display two textbox in customMessageBox?

Tags:

c#

messagebox

Well, I want to display two text boxes next to next in customMessageBox. So i have coded for two Text Boxes. like below. I named soora and ayath for it. But in customMessageBox, i cannot call two text boxes in the same time. It shows error. How to display two text boxes next to next in customMessageBox. I only the error and it is form Content = soora + ayath

My C# CODE;

TextBox soora = new TextBox();
                soora.Height = 72;
                soora.Width = 150;
                soora.MaxLength = 3;

TextBox ayath = new TextBox();
                ayath.Height = 72;
                ayath.Width = 150;
                ayath.MaxLength = 3;

CustomMessageBox messageBox = new CustomMessageBox()
            {
                Title = "GO TO",
                Content = soora + ayath,
                RightButtonContent = "Go !",
            };
like image 315
Mohamed Thaufeeq Avatar asked Aug 14 '13 05:08

Mohamed Thaufeeq


1 Answers

use a container control to hold both textboxes

TextBox soora = new TextBox();
                soora.Height = 72;
                soora.Width = 150;
                soora.MaxLength = 3;

TextBox ayath = new TextBox();
                ayath.Height = 72;
                ayath.Width = 150;
                ayath.MaxLength = 3;

StackPanel container = new StackPanel{
                           Orientation = System.Windows.Controls.Orientation.Horizontal
                       };

container.Children.Add(soora);
container.Children.Add(ayath);    

CustomMessageBox messageBox = new CustomMessageBox()
            {
                Title = "GO TO",
                Content = container,
                RightButtonContent = "Go !",
            };
like image 137
Ashok Damani Avatar answered Sep 30 '22 05:09

Ashok Damani