whats wrong in this, i cannot take a reaction from label

ewuss12d

New member
Joined
Oct 22, 2023
Messages
1
Programming Experience
Beginner
C#:
private void button4_Click(object sender, EventArgs e)
  {



      string seciliİslem = comboBox2.SelectedItem.ToString();
      int bakiye = 2000;

      switch (seciliİslem)
      {
          case "Bakiye Görüntüle":
              string bakiyeMetni = bakiye.ToString();
              label11.Text = bakiyeMetni;
              break;
          case "Para Çek":
              int cekilecekTutar = Convert.ToInt16(textBox4.Text);
              if (cekilecekTutar > bakiye)
              {
                  label11.Text = "Bakiyenizden Fazla Tutar Çekemezsiniz";
              }
              else
              {
                  int kalanTutar = bakiye - cekilecekTutar;
                  label11.Text = kalanTutar.ToString();
              }
              break;
          case "Para Yatır":
              int yatirilacakTutar = Convert.ToInt16(textBox4.Text);
              int yeniTutar = bakiye + yatirilacakTutar;
              bakiye = yeniTutar;
              label11.Text = yeniTutar.ToString();
              break;
          case "Çıkış Yap":
              label11.Text = "Hesabınızdan Çıkış Yapıldı";
              break;
      }
 
Last edited by a moderator:
Please do not just dump code in post.

The title of a thread is supposed to be a summary of your problem. In body of the post, provide a more detailed explanation of what you are trying to do, what problem you are running into, and what you have done to try to solve the problem, and then present the code that has the problem.

People in this forum will typically invest time in helping you if you invest time in asking your question, and making it as easy as possible for others to try to help you. If it feels like you don't really care, it's more likely that others won't care either.
 
I don't even know what the title means, which makes matters even worse. What "reaction" are you expecting from this Label and why? I see code that is presumably the Click event handler of a Button. Are you saying, without actually saying, that label11 doesn't display the expected text when you click that Button? As suggested, you need to explain your actual problem. That means exactly what you're trying to achieve, how you're trying to achieve it and what happens when you try. You also need to have debugged your code, i.e. set breakpoints in appropriate places and stepped through the code, examining the state at each step. If you haven't debugged then do that now and tell us exactly what you se. Maybe that code isn't even being executed, but that something that you need to know before posting here. If you don't know how to debug then you should stop what you're doing and learn that first, because it's an essential skill for all developers.
 
I would also point out that it's very bad that you have controls named button4, comboBox2, textBox4 and label11. Those names are meaningless, even to you. Put that code away for a week and come back to it and you'll have no idea what they are for. ALWAYS provide descriptive names for things. We - that includes you - should be able to look at the name of those controls and have a pretty good idea of what they are for. Apart from helping you understand your own code and spot logic errors, it makes it much easier for us to understand your code and therefore easier to help you. If your code is a wall of meaningless text with generic names and no co9mments, it doesn't really inspire us to make the effort to help you.
 
Back
Top Bottom