Click here to Skip to main content
15,887,361 members
Home / Discussions / C#
   

C#

 
AnswerRe: Project_1.exe.config and Project_2.dll.config Pin
AndieDu1-Oct-09 16:38
AndieDu1-Oct-09 16:38 
GeneralRe: Project_1.exe.config and Project_2.dll.config Pin
Calla1-Oct-09 20:14
Calla1-Oct-09 20:14 
Questionhow to display a string on website through windows form Pin
Barkha Shreri30-Sep-09 11:23
Barkha Shreri30-Sep-09 11:23 
AnswerRe: how to display a string on website through windows form Pin
Abhishek Sur30-Sep-09 12:06
professionalAbhishek Sur30-Sep-09 12:06 
AnswerRe: how to display a string on website through windows form Pin
Tamer Oz30-Sep-09 19:23
Tamer Oz30-Sep-09 19:23 
GeneralRe: how to display a string on website through windows form Pin
Barkha Shreri1-Oct-09 1:38
Barkha Shreri1-Oct-09 1:38 
GeneralRe: how to display a string on website through windows form Pin
Barkha Shreri1-Oct-09 3:15
Barkha Shreri1-Oct-09 3:15 
QuestionC#: Need help deleting new button instances that i've create in my program! Please Help! Pin
jyjt_code30-Sep-09 10:14
jyjt_code30-Sep-09 10:14 
Hi, Smile | :) I'm currently stuck at my assignment where I need to create new buttons by naming it and also able to delete it after right clicking on it, choosing "delete" from the contextMenu

Here's my code

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

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

        private void button1_MouseDown(object sender, MouseEventArgs e)
        {
            Point p = new Point(e.X, e.Y);


            if (e.Button == MouseButtons.Right)
            {
                contextMenuStrip1.Show(button1, p);
            }

        }

        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            button1.Dispose();
            //I don't know what to enter here to delete the new button...
           
        }
       
        private void bt_add_Click(object sender, EventArgs e)
        {
            Button newButton = new Button();
            newButton.Name = tb_name.Name;
            newButton.Text = tb_name.Text;
            flowLayoutPanel1.Controls.Add(newButton);
            newButton.MouseDown += new MouseEventHandler(newButton_MouseDown);
           
        }

        void newButton_MouseDown(object sender, MouseEventArgs e)
        {
            
            Point p = new Point(e.X, e.Y);


            if (e.Button == MouseButtons.Right)
            {
                //I don't know what to enter here to right click next to
                //the new button...
                //I tried this  -->   contextMenuStrip1.Show(newbutton ,p);
                //but it can't work?!
            }

        }

        
        
        
    }
}

AnswerRe: C#: Need help deleting new button instances that i've create in my program! Please Help! Pin
Christian Graus30-Sep-09 11:13
protectorChristian Graus30-Sep-09 11:13 
GeneralRe: C#: Need help deleting new button instances that i've create in my program! Please Help! Pin
jyjt_code30-Sep-09 16:35
jyjt_code30-Sep-09 16:35 
GeneralRe: C#: Need help deleting new button instances that i've create in my program! Please Help! Pin
Christian Graus30-Sep-09 16:39
protectorChristian Graus30-Sep-09 16:39 
QuestionButton navigate Pin
Texas38930-Sep-09 9:10
Texas38930-Sep-09 9:10 
AnswerRe: Button navigate [modified] Pin
Ian Shlasko30-Sep-09 9:23
Ian Shlasko30-Sep-09 9:23 
GeneralRe: Button navigate Pin
Texas38930-Sep-09 11:10
Texas38930-Sep-09 11:10 
QuestionProblem executing a named pipe service Pin
AndyASPVB30-Sep-09 8:55
AndyASPVB30-Sep-09 8:55 
AnswerRe: Problem executing a named pipe service Pin
Ian Shlasko30-Sep-09 9:26
Ian Shlasko30-Sep-09 9:26 
GeneralRe: Problem executing a named pipe service Pin
AndyASPVB30-Sep-09 9:51
AndyASPVB30-Sep-09 9:51 
GeneralRe: Problem executing a named pipe service Pin
saber.softs30-Sep-09 11:02
saber.softs30-Sep-09 11:02 
GeneralRe: Problem executing a named pipe service Pin
AndyASPVB1-Oct-09 10:43
AndyASPVB1-Oct-09 10:43 
QuestionLoadLibrary gets stuck when calling it from a thread that is not the main thread Pin
Alexeirob30-Sep-09 7:50
Alexeirob30-Sep-09 7:50 
QuestionMultiple log4net files. Pin
Albu Marius30-Sep-09 5:00
Albu Marius30-Sep-09 5:00 
AnswerRe: Multiple log4net files. Pin
Albu Marius1-Oct-09 0:28
Albu Marius1-Oct-09 0:28 
QuestionThe underlying provider failed on Open Pin
abbd30-Sep-09 4:23
abbd30-Sep-09 4:23 
AnswerRe: The underlying provider failed on Open Pin
Matt Meyer30-Sep-09 5:26
Matt Meyer30-Sep-09 5:26 
QuestionRe: The underlying provider failed on Open Pin
abbd30-Sep-09 6:20
abbd30-Sep-09 6:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.