Click here to Skip to main content
15,914,608 members
Home / Discussions / C#
   

C#

 
GeneralRe: TreeView Pin
Udayaraju15-Feb-09 4:53
Udayaraju15-Feb-09 4:53 
GeneralRe: TreeView Pin
Udayaraju15-Feb-09 5:09
Udayaraju15-Feb-09 5:09 
GeneralRe: TreeView Pin
Udayaraju15-Feb-09 5:20
Udayaraju15-Feb-09 5:20 
QuestionFile Processing Error Pin
MumbleB11-Feb-09 19:53
MumbleB11-Feb-09 19:53 
AnswerRe: File Processing Error Pin
ABitSmart11-Feb-09 21:04
ABitSmart11-Feb-09 21:04 
GeneralRe: File Processing Error Pin
MumbleB11-Feb-09 21:08
MumbleB11-Feb-09 21:08 
AnswerRe: File Processing Error Pin
Eddy Vluggen11-Feb-09 21:25
professionalEddy Vluggen11-Feb-09 21:25 
QuestionOn button click-context menu strip Pin
Udayaraju11-Feb-09 19:47
Udayaraju11-Feb-09 19:47 
I have 30 buttons and I am trying to implement context menu on each button click by using following method.
void OnButtonClick(object sender, EventArgs e)
    {
        Button btn = (Button)sender;
        btn.ContextMenuStrip.Show(btn, new System.Drawing.Point(0, btn.Height));
    }

I have 2 context menu strip items, Add text Label and Add colour
private void addTextLabelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Control item in panel2.Controls)
            {
				Button btn = (Button)item;
                if (string.IsNullOrEmpty(btn.Text.Trim()))
                {
                    frmAddText form = new frmAddText();
                    form.ShowDialog();

                    if (frmAddText.IsTextMod)
                    {
                        return;
                    }
                    btn.Text = form.TextInfo;
                    btn.Tag = 0;
                }				} }

Wen i try to do this it is implementing on last button itself. Here Ia m returning
Here foreach is not acceptable.

private void addColourToolStripMenuItem_Click(object sender, EventArgs e)
        {
            colorDialog1.ShowDialog();
            DialogResult dResult = colorDialog1.ShowDialog();
            foreach (Control item in panel2.Controls)
            {
                Button btn = (Button)item;
                string strBtnName = btn.Name;
                if (string.Equals(btn.Name, strBtnName, StringComparison.OrdinalIgnoreCase))
                {                   
                    if (dResult == DialogResult.OK)
                    btn.BackColor = colorDialog1.Color;
                }            }        }

It is applying color to all buttos. But it should apply for only specific clicked button. Here foreach is not acceptable.
AnswerRe: On button click-context menu strip Pin
ABitSmart11-Feb-09 20:08
ABitSmart11-Feb-09 20:08 
AnswerRe: On button click-context menu strip Pin
DaveyM6911-Feb-09 22:56
professionalDaveyM6911-Feb-09 22:56 
GeneralRe: On button click-context menu strip Pin
Udayaraju15-Feb-09 4:54
Udayaraju15-Feb-09 4:54 
GeneralRe: On button click-context menu strip Pin
DaveyM6915-Feb-09 6:33
professionalDaveyM6915-Feb-09 6:33 
Questionc# Pin
aratireddy11-Feb-09 17:14
aratireddy11-Feb-09 17:14 
AnswerRe: c# Pin
ABitSmart11-Feb-09 18:43
ABitSmart11-Feb-09 18:43 
QuestionHow to create and execute of a simple Function with input and output parameters in pl/sql using with c#.net Pin
AnilJayanti11-Feb-09 16:40
AnilJayanti11-Feb-09 16:40 
Questionleading numbers in a text string appearing at end of text in a Rich Text Box. Pin
Willbo_II11-Feb-09 15:15
Willbo_II11-Feb-09 15:15 
GeneralRe: leading numbers in a text string appearing at end of text in a Rich Text Box. Pin
Luc Pattyn11-Feb-09 16:02
sitebuilderLuc Pattyn11-Feb-09 16:02 
QuestionSet license key / product in c# project - installation package. Pin
thecodesource7911-Feb-09 14:55
thecodesource7911-Feb-09 14:55 
AnswerRe: Set license key / product in c# project - installation package. Pin
DJ-Boris12-Feb-09 0:31
DJ-Boris12-Feb-09 0:31 
GeneralRe: Set license key / product in c# project - installation package. Pin
thecodesource7912-Feb-09 13:52
thecodesource7912-Feb-09 13:52 
AnswerRe: Set license key / product in c# project - installation package. Pin
Member 114976512-Dec-09 0:53
Member 114976512-Dec-09 0:53 
QuestionStartup Performance Pin
Wizard_0111-Feb-09 11:00
Wizard_0111-Feb-09 11:00 
QuestionSomething better than Switch Case Pin
Muammar©11-Feb-09 10:12
Muammar©11-Feb-09 10:12 
AnswerRe: Something better than Switch Case Pin
akidan11-Feb-09 10:20
akidan11-Feb-09 10:20 
GeneralRe: Something better than Switch Case Pin
Muammar©11-Feb-09 10:28
Muammar©11-Feb-09 10:28 

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.