how to create window application/dialog box

Ask general questions here.
kumprave5
Posts: 33
Joined: Wed Jul 18, 2018 9:55 pm

how to create window application/dialog box

Post by kumprave5 » Tue Aug 21, 2018 6:09 pm

I am using below code to create windows form, it creates an empty form. I mean I have added ListBox but it is not visible in the window. (Please see screenshot)
public partial class Form1 : Form
{
public Form1()
{
// The InitializeComponent() call is required for Windows Forms designer support.
InitializeComponent();
// TODO: Add constructor code after the InitializeComponent() call.
}

public void Form1_Load(object sender, EventArgs e)
{
ListBox list = new ListBox();
list.Items.Add("sunday");
}

}
To access this form in the code module I am using
Form1 st = new Form1();
st.ShowDialog();
Attachments
form.PNG
form.PNG (7.31 KiB) Viewed 100 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: how to create window application/dialog box

Post by odklizec » Tue Aug 21, 2018 6:16 pm

Hi,

Some time ago, I posted a code module, showing how to create a form with input and buttons, which can be used to pause the test. It may help with your problem too. Take a look at this post...
pause-test-with-message-box-t12193.html
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

kumprave5
Posts: 33
Joined: Wed Jul 18, 2018 9:55 pm

Re: how to create window application/dialog box

Post by kumprave5 » Thu Aug 23, 2018 4:13 pm

Thank you so much. This is exactly what I was looking for.