Jump to content
Xtreme .Net Talk

aewarnick

Avatar/Signature
  • Posts

    1052
  • Joined

  • Last visited

Everything posted by aewarnick

  1. Do I even have to use Serialize and Deserialize to read and write to and from files?
  2. I did notice in the book that NewLog is just an object class. Not a form and it says [serializable] at the top. Do I have to do some major modification by putting all my code in another place?
  3. I cannot convert my stream to a type NewLog just like my book says. private void ReadIt() { string f="CommLog\\2_9_2003.txt"; stream=new FileStream(f, FileMode.Open, FileAccess.Read); NewLog Log=(NewLog)reader.Deserialize(stream); } I always get the error message about not being able to convert it.
  4. private void SaveB_Click(object sender, System.EventArgs e) { string FormData=GetData(); string f="CommLog\\"+DateTime.Now.ToShortDateString()+".txt"; f=f.Replace("/","_"); MessageBox.Show(FormData); output=new FileStream(f, FileMode.OpenOrCreate, FileAccess.ReadWrite); writeIt.Serialize(output, FormData); } Why do I get a whole bunch of silly characters in my text file when I save it to disk?
  5. Nevermind! int[][]x = new int[6][]; should be: int[][]x = new int[3][];
  6. Error: Highlights the j loop and says, "Object reference not set to an instance of an object." Help. int[][]x = new int[6][]; x[0]=new int[] {1,2}; x[1]=new int[] {3,4,5}; x[2]=new int[] {6,7}; for (int i=0; i<x.Length; ++i) for (int j=0; j<x.Length; ++j) { RTB1.Text+=" "+x.Length; TB2.Text+=" "+x.Length; TB1.Text+=x[j]; RTB2.Text+=x[j]; }
  7. I'm with you. I don't feel like figuring it out either. It works now, so I am happy. Actually I have a subscripted array problem now that should be simple but is giving me trouble. I'll post that elsewhere.
  8. I tried and tried till I could try no more!! So I just changed it completely: //do3 public void do3() { TB1.Focus(); TB1.SelectAll(); check2(TB1.Text); RTB2.Text=y; } bool b=false; string y=""; void check2(string text) { char[] chrarray = text.ToCharArray(); foreach (char x in chrarray) { if (char.IsDigit(x)) y+=x; else if (x=='.' && b==false) {b=true; y+=x;} } }
  9. Why do dots always print when the bool value should be set to true after one dot? private void do3() { if(TorF(TB1.Text)) RTB2.Text=TB1.Text; } bool check2=false; public bool TorF(string str) { char[] chr = str.ToCharArray(); foreach (char dummy in chr) { if (char.IsDigit(dummy)) return true; else if (dummy=='.'&& check2==false) {check2=true; return true;} } return false; }
  10. That is it!!
  11. Works great! But there probably is anotherway to do it.
  12. Ok. That clears things up alot. Thanks so much for all your help. I am learning things.
  13. I tried removing that and also just writing Run(); but it never works without Application.Run(); Is that the way it should be? Also, I noticed in the properties window something about having more than one Main(). Is that possible?
  14. Let's just make it simple and say that the picture_Click will be disabled after they use it once.
  15. I found it and changed the starting object to form1 (it was my only choice.) but it still does the same thing when I remove Run.
  16. I'll try it out later. I am gathering all this info so that I don't forget it. Thank you.
  17. You mean this picture (attatched)
  18. Well, I would like to be able to set a limit on how many times the user can press that button at certain times.
  19. I went to Set startup projects and they are both under WindowsApplication2 namespace.
  20. Also, this does not compile: pictureBox1.Lock=true;
  21. How would I make this click event only do these commands once and another set every other time it is clicked? Use a while or for structure with a static variable? private void pictureBox1_Click(object sender, System.EventArgs e) { string outputStr = ""; foreach(char myChar in x.Text) {//even gets spaces: if(!Char.IsSymbol(myChar)&&(!Char.IsLetter(myChar))) { outputStr += myChar.ToString(); } }
  22. I tried removing Application.Run here but the program immediately closed. static void Main() { Form3 frm3=new Form3(); frm3.Show(); Application.Run(); }
  23. I have a picturebox that is clickable on my form. I would like to disable the click at a certain time but when I use pictureBox1.Enabled=false; to disable it the gif animation stops. How can I disable the click without stopping the animation?
  24. What if I come accross a situation where I can only test to see if a user enters in characters or numbers but I cannot test by using try/catch. if (textbox1==(char)){}??? if (textbox1==(int)){}??? if (textbox1==(double)){}???
×
×
  • Create New...