🔒 Closed how to enabled and disabled button

Status
Not open for further replies.

m0stwanted143

Eternal Poster
If the 3 label amount has no value the button is disabled,
otherwise if any of the 3 label has a value then the button is enabled
 
Iito po yung windows Form ko
 

Attachments

  • q.webp
    q.webp
    24.2 KB · Views: 45
try nyo po lagyan ng textchanged event yung textbox

C#:
private void textBoxes_TextChanged(object sender, EventArgs e)
{
    button1.Enabled = GetInt(textBox1) > 0 || GetInt(textBox2) > 0 || GetInt(textBox3) > 0;
}

int GetInt(TextBox text)
{
    int i = 0;
    int.TryParse(text.Text.Trim(), out i);
    return i;
}

project dl link: You do not have permission to view the full content of this post. Log in or register now.
 
try nyo po lagyan ng textchanged event yung textbox

C#:
private void textBoxes_TextChanged(object sender, EventArgs e)
{
    button1.Enabled = GetInt(textBox1) > 0 || GetInt(textBox2) > 0 || GetInt(textBox3) > 0;
}

int GetInt(TextBox text)
{
    int i = 0;
    int.TryParse(text.Text.Trim(), out i);
    return i;
}

project dl link: You do not have permission to view the full content of this post. Log in or register now.
Paps paanu naman po kung label ung ginagawa ko Textbox po kasi ung ginawa nyo po paps.. Salamat sa sagot mo paps
 
Paps paanu naman po kung label ung ginagawa ko Textbox po kasi ung ginawa nyo po paps.. Salamat sa sagot mo paps
ganun padin naman palitan nalang ng Label yung TextBox bali ang gagawin nalang ay
C#:
        private void text_changed(object sender, EventArgs e)
        {
            button1.Enabled = GetInt(label1) > 0 || GetInt(label2) > 0 || GetInt(label3) > 0;
        }

        int GetInt(Label text)
        {
            int i = 0;
            int.TryParse(text.Text.Trim(), out i);
            return i;
        }
para sa iba na di alam
1. i ctrl+click yung mga label
2. sa properties iclick events (kidlat na icon)
3. sa events hanapin ang TextChanged
4. itype ang text_changed habang nakaselect yung tatlong label

dl link: You do not have permission to view the full content of this post. Log in or register now.
 
Status
Not open for further replies.

About this Thread

  • 5
    Replies
  • 555
    Views
  • 3
    Participants
Last reply from:
Shiraori

Trending Topics

Online now

Members online
1,026
Guests online
1,044
Total visitors
2,070

Forum statistics

Threads
2,274,739
Posts
28,957,893
Members
1,233,411
Latest member
marti
Back
Top