"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Showing posts with label Windows Application. Show all posts
Showing posts with label Windows Application. Show all posts

Monday, September 5, 2011

How to pass value from one form to another [Windows Application]

On form1
  •  
  • namespace WindowsFormsApplication1
  • {
  • public partial class Form1 : Form
  • {
  • Form2 ob;
  • public Form1()
  • {
  • InitializeComponent();
  • }
  •  
  • private void button1_Click(object sender, EventArgs e)
  • {
  • string s;
  • s = comboBox.SelectedIndex;
  • ob = new Form2(s);
  • ob.Show();
  • }
  • }
  • }
On form2
  • namespace WindowsFormsApplication1
  • {
  • public partial class Form2 : Form
  • {
  • string ss;
  • public Form2(string s)
  • {
  • InitializeComponent();
  • ss = s;
  • comboBox.SelectedIndex = ss;
  • }
  • }
  • }
Hope u got that Now !!!

Have a nice day... 'N happy Coding :)

Friday, August 5, 2011

Create Shortkeys in Windows Application

Hi *.*,
I had done only 2 projects(Minor) in windows application (Desktop). I'm planning to improve my knowledge over their too...Starts from here... :)

Create a new form named form1.And add a menu-strip on design space now moving towards code side over their u can find a method InitializeComponent(); right click and Go To Definition over their u can find initializing menu-strip just down different events are initializing on the menu-strip. Find which one you need to add short key and create an instance of that at their.

Example for short key ctrl+N

this.[controlname].ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));

Stay tune...

Have a nice day... 'N happy Coding :)