View Single Post
Old Feb 10th, 2007, 2:37 PM   #3
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 406
Rep Power: 5 xavier is on a distinguished road
Send a message via Yahoo to xavier
[quote]Your problem is the lack of a MessageBox in C#[quote]
NewsFlash

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        string Var1 = "" ;
        public void MessageShow()
        {
        MessageBox.Show("Yo!"+Var1,"",MessageButton.OK);
        }

        private void button1_Click(object sender, EventArgs e)
        {
             Var1 = @"Man";   
             MessageShow();
        }
        
        private void button2_Click(object sender, EventArgs e)
        {        
          Var1 = @"Dude";
          MessageShow();        
        }
    }
}

I haven't tried it but the problem i think was that Var1 was defined in every function and it existed only inside that function. Now I've declared as a global variable. Also you need to set Var1 to Dude before u call MessageShow().
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote