thanks
Lim Yuxuan
Posts
-
Problem with Form -
Problem with FormErm.. where should I put the
Application.OpenForms[0].Show();
code ? I cant find an event handler that triggers when you closes a form.
-
Problem with FormYup Its a tic-tac-toe. I am using labels for the "O" and "X". But. I think I will use MDI instead because I could not figure out where to put the
frmMenu.Show();
code to show the menu form once i close the game form (I could not find any event handler that triggers when you close the form). EDIT:
Application.OpenForms collection would help out then.
oh wait ...
modified on Monday, September 14, 2009 7:26 PM
-
Problem with FormThanks it worked the way I wanted it to be.
-
Problem with Formwhere are you calling your initial frmMenu form from?
I think your problem is you are creating frm2Players from within frmMenu which means when that closes it will close all children.Yup. That is what happens when I tried to execute the .Close() method. I tried d@nish 's method and it worked the way I wanted it to be. Thanks anyway :)
-
Problem with FormThe menu form did closed but it seems that if the menu form is closed, the new form is closed together with it ... hmm maybe I should try MDI ?
-
Problem with FormYes. btn2Player calls a new form and after calling the new form, it will remove the old one (menu form)
-
Problem with FormHi guys,I have a program that starts with a menu form. It will create a new form and remove the menu form after the user pressed a certain button. So I tried the following method :
private void btn2Player_Click(object sender, EventArgs e)
{
frmMenu frmMenu = new frmMenu();// menu form
frm2Players frm2P = new frm2Players();//new form
frm2P.Show();//display new form
frmMenu.Close();//Close the menu form
}The new form that it is supposed to create shows up but strangely the menu form is still there. What should I do ?
-
File Not Found Exception Handlingthanks it worked well that way.
-
File Not Found Exception HandlingHi I am trying to handle a file not found exception by creating the specified text file if it does not exists. void RetrieveData() { if(File.Exists("books.txt") == false) // if file doesnt exists { File.Create("books.txt"); // create the file } //Create a stream reader object to read from "books.txt" StreamReader DataReader = new StreamReader("books.txt"); } I did a test run and remove the books.txt file from the current working directory on purpose and when i start debugging all I get is this exception : The process cannot access the file 'C:\Documents and Settings\Administrator\My Documents\NYP Work\C#\MiniProject 2009\PhotoAlbum_V2\bin\Debug\books.txt' because it is being used by another process. Any suggested solutions ?
-
How do i retrieve the directory of multiple images file without hard code ?Thanks
-
How do i retrieve the directory of multiple images file without hard code ?Hi. I had a photo album project and I was wondering is there anyway to retrieve the directory of images with minimum hardcoding ? What I am currently doing now is this : //prefix of the directory of large images const string strLargePrefix = "/images/large/"; //suffix of the directory of large images const string strLargeSuffix = "_large.jpg"; //group the pictures together with each of them assigned with a reference number enum enuImages { //note that the first image will have its reference number //as its position number-1.Example: 2nd image = 2-1 = reference number 1 cHTP3 =0, //1st image cppHTP4 = 1, //second image csharpFEP1 = 2,//third image jHTP4 = 3, //4th image jwsFEP1 =4, //5th image vbnetFEP1 = 5 //6th image } RetrieveData() { // An enumeration object that represents the images based on their // reference number. Initial reference set to 1st image enuImages m_Images = 0; //Array index of the image to be stored at base on their reference number. //Index number has the same value as reference number. int intIndex = 0; //Retrieve directory path of the Large images and sort them for (intIndex = 0; intIndex < int_TotalImages; intIndex++ ) { strLargeImage[intIndex] = Directory.GetCurrentDirectory() + strLargePrefix + m_Images + strLargeSuffix; m_Images++;//increment the reference number to represent next image }// end for loop } I dont really like the idea of grouping the images together because I have to hard code the names of the image file. But I have no choice as it works with the for loop. Is there any method that behaves like the file.ReadAllLines() that can retrieve all the images from that folder and return them as a form of array ?
-
pseudorandom number generator algorithmLOL. It is a pratical random generator. I used to write numbers on my square eraser and toss them to decide my answer for Multiple Choice Questions during tests that I didnt study.
-
richtextbox 's DetectUrls propertyThanks it worked.
-
richtextbox 's DetectUrls propertyI had set the DetectUrls property of the richtextbox object to true. When I typed an URL address, the address would be automatically underlined and the color of the font would be in blue and when ever I move the cursor over the address, it will change from an "I beam" to a "hand". However, when I clicked the url, nothing happened. I expected the Internet Explorer 's window to pop out. Can anyone tell me what should I do ?
-
Need help with Backspace button!!Thanks. I have read the description of the remove method from the intellisense and it explains alot.
-
Need help with Backspace button!!Thanks. I read the description of the remove method from the intellisense and it explains alot.
-
Need help with Backspace button!!Hi ! I am designing a simple calculator application and I am having trouble coding the backspace button. I store the data that the user had input in a string by the name of strInput with initial value strInput = "" . I display the value that the user had clicked by coding : lblDisplayPanel.Text+="value of button"; For example, lets take a look at my button 1 private void btn1_Click(object sender, EventArgs e) { lblDisplayPanel.Text += "1"; } so when I click button 1 thrice, the display panel will show "111". However, I only know how to add values to the display panel label. I tried -= but it wont work . The backspace button is supposed to remove the last value entered by the user but how do I do that ?
-
How do programmers relax?Go get some tibits to eat or make myself a sandwich.
-
How do I create a label thats display the time like a digital clock ?Thanks for your efforts guys. In the end this is what I did. private Timer Clock = new Timer();//create a timer void Clock_Tick(object sender, EventArgs e) { //refresh the time every 1 second this.winFormTimerLabel.Text = DateTime.Now.ToLongTimeString(); } private void Form1_Load(object sender, EventArgs e) { Clock.Interval = 1000;//every 1 second do something //what the program is supposed to do when 1 second elasped Clock.Tick += new EventHandler(Clock_Tick); Clock.Start();//starts the timer } I finally understood where did I went wrong - I did not put in the interval value and I did not start the timer..... silly me :laugh: