Event Handling in C# Triggering a Button
Answer / guest
using System;
using System.Windows.Forms;
using System.Drawing;
public class Butevent:Form {
TextBox t1 = new TextBox();
Button b1 = new Button();
public Butevent() {
this.Text = "C# Program ";
t1.Location = new Point(20,30);
b1.Text = "Click here to activate";
b1.Location = new Point(20,55);
b1.Size = new Size(150,20);
// Invoking Method or EventHandler
b1.Click+=new EventHandler(OnClick);
this.Controls.Add(t1);
this.Controls.Add(b1);
// Invoking Method or EventHandler
this.Resize += new EventHandler(OnResize);
}
//Applying EventHandler
public void OnResize(object sender,EventArgs ee) {
MessageBox.Show("oops! Form Resized");
}
//Applying EventHandler
public void OnClick(object sender,EventArgs e) {
t1.Text = "Hello C#";
}
public static void Main() {
Application.Run(new Butevent());
}
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Can you declare an array of mixed Types?
program for straight line(y=mx+c)
c# coding for a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors not using the Big-integer and Exponential Function's.
Hello I am hosting remoting within IIS. Everything works just fine as long as I allow anonymous access at the IIS level. When I allow only Windows Authenticated sessions, something very strange happens: If the client activates the remote object with IP address - works fine If the client activates it using a machine name - get http 401 exception is thrown. The exception is thrown when the client calls the remote method. I set the channel's useDefaultCredentials property to true. Any idea how to allow Windows Authentication? Here is the call stack: System.Net.WebException: The remote server returned an error: (401) Unauthorized .. ---> System.ComponentModel.Win32Exception: The target principal name is incorrect at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean handshakeComplete) at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob, Boolean handshakeComplete) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.Authenticate(String challenge, WebRequest webRequest, ICredentials credentials) at System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials) at System.Net.AuthenticationState.AttemptAuthenticate (HttpWebRequest httpWebRequest, ICredentials authInfo) --- End of inner exception stack trace ---
. Write a program to print the following outputs using for loops $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
How to Create a Treeview Menu in ASP.NET with C#?
how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)
Write a program to input an integer and - display the reverse - display the sum of each digit - should include logic that considers the input number as any number of digits long
program for string reverse(eg:- i am boy -> boy am i)
8 Answers Black Pepper, Infosys, Mind Tree,
program to reverse the order of digits in a given number of any length.
Write a function which accepts list of nouns as input parameter and return the same list in the plural form. Conditions: i) if last letter is r then append s ii) if word ends with y then replace it by ies iii) call this function in main() and produce the required output. for eg:- if chair is input it should give chairs as output.
program for addition of fraction(M/N + P/Q = Y/Z)