Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
With each click on the picture box the number in the output label must decrement by one.
You need an event handler for the clicking of the image, and an int to keep track of how many times it was clicked; here is some pseudocode to get you started:
int timesClicked = 42;
private void Img_Click(sender object, eventargs e)
{
timesClicked--;
UpdateLabel();
}
internal void UpdateLabel()
{
label.Caption = timesClicked.ToString();
}
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I need an event or notification that signals when a form changes from one screen to another.
I know I can poll for this, but I'm looking for a non-polling solution.
You can use ResizeEnd event on Control that is fired when the control is resized or moved.
Then you can use Screen.FromControl() to get the actual screen.
Example :
public partial class Form1 : Form
{
private Screen _actualScreen;
public Form1()
{
InitializeComponent();
_actualScreen = Screen.FromControl(this);
this.ResizeEnd += Form1_ResizeEnd;
}
private void Form1_ResizeEnd(object sender, EventArgs e)
{
if(_actualScreen != Screen.FromControl(this))
{
//Your treatment
}
}
}
I Hope this solution can help you !
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have this error and I have no ideo about what should I do
The aim is when I click to button, it should read the word in textbox and save it into the string variable by its new factor.I have the error oin the topic
private void panel_button_kelimeekle_kaydet_Click(object sender, EventArgs e)
{
if(panel_checkbox_ing.Checked)
{
string (panel_textbox_kelimeekle_yab.Text) = Ingkelimeler[(Ingkelimeler.Length+1)];
}
}
If panel_textbox_kelimeekle_yab is already a textbox on your form, then you don't need to declare its type when you assign a value to it. C# thinks you're trying to declare a new string variable.
Change that line of code to
panel_textbox_kelimeekle_yab.Text = Ingkelimeler[(Ingkelimeler.Length+1)];
This probably won't solve all your problems, but at least it will get you on to the next error message. (You probably mean Length-1 in your array index, but there's really no way for us to know.)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to do something like this:
Button button = new Button("Button");
button.addClickListener(new ClickListener(){
//Implement required methods here..
});
How can i do this in C#?
Attach the event handler:
button.Click += myClickEvent;
...
protected void myClickEvent(Object sender, EventArgs e)
{
// do your thing
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
private void button1_Click(object sender, EventArgs e)
{
string StudentNo = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString();
frmEdit EditForm = new frmEdit();
EditForm.StudentNo;
EditForm.ShowDialog();
}
You probably meant to write
EditForm.StudentNo = StudentNo;
instead of just
EditForm.StudentNo;
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have simple question. How do I pause program? I want to change pictures very slowly.
My code:
private void button2_Click(object sender, EventArgs e){
Image picture1 = Program.Properties.Resources.picture1;
Image picture2 = Program.Properties.Resources.picture2;
Button1.Image = picture1
//Here I want pause
Button1.Image = picture2
}
If you want procedural code (like in your example), without timers and without locking the UI:
await Task.Delay(1000)
You can use Threads or Timers.
http://msdn.microsoft.com/en-us/library/swx5easy.aspx
http://programmingbaba.com/how-to-stop-system-threading-timer-in-c-do-net/
Or you can use Sleep method to puase your program.
http://www.dotnetperls.com/sleep