Jump to content
Xtreme .Net Talk

aewarnick

Avatar/Signature
  • Posts

    1052
  • Joined

  • Last visited

Everything posted by aewarnick

  1. static void Main() { Form_A instance_A= new Form_A(); instance_A.Show(); Application.Run(); } You get that error because instance_A is only known in the block it is declared in- (Main). Try this: Declare instance_A inside only the class block making it a global variable: Form_A instance_A; You may need to make it null. EX: Form_A instance_A=null; Then in Main: instance_A= new Form_A(); Always remember this: variables declared in a block are only known in that block unless they are declared static.
  2. If you have Visual Studio you can open the Solution Explorer and then right click on the second icon down which should be your class name then choose Add, existing item. Choose your wav file then go down to your file and click on it once. You should see it's properties. If not right click and choose, Properties. For build action choose embedded recource. I am not sure if that is what you want to do but the wave file will be in your program. I am not sure, but I think to play it in your program you would have to save it to the hard drive if you do it the way I mentioned above. I was just thinking about how play music in my programs, so if anyone else posts an answer, I would like to hear it.
  3. Ohhhhh hhhh h! It will be distributed to anyone and I think it will be free too. They will most likely not have VS.
  4. I don't understand the question about a distribution anyting?
  5. When the user opens the exe file I don't want it to show the form but a notify icon will be in the taskbar for the user to Show() the form with.
  6. I cannot use Hide() or the visible property in the constructor or Load() to hide my form when it is initializing. I cannot leave out the constructor code because this program runs in the background. The form needs to be initialized but I don't want the user to see it until they click the notify icon.
  7. That is helpful for some things but what I wanted was a message that will pop up for a user that does not have the framework at all installed when they click on my program displaying a link label of where to get it.
  8. Seen anything about self running programs?
  9. I have win98. Could you let me try your service and see if it works? I'll pm my e-mail address to you. Please don't give it out, it is the one I want to keep ads out of.
  10. I never enter a user name and password when I reboot. Does that mean that I am not logged on?
  11. What is the advantage of using a service over using a notify icon or just hiding the window and the window icon box? From what I read, you can only use the services for nt versions unless I read wrong.
  12. For some reason I do not have that option in VS. I got it for 99 at staples. Do I have a lower grade version? And, from what I have read on the net it is only for nt versions of windows. What I am talking about is a program that runs in the system tray beside the clock. Or even better would be one that has the ability to run in the tray or only be found in the running processes window.
  13. Sorry, when you bring up the running processes using cntl alt del you see the list of them but not all of them are in the system tray by the clock. How would I make any program run in the background like they do in the tray and not in the tray?
  14. Does MS or anyone make a warning you can put in your program if someone does not have the framework and how to get it? All that showes now is about some dll missing. Or, is it possible to make my own error message about that?
  15. Something that runs in the sys tray and something that does not?
  16. Do you think they will upgrade the framework to fix it?
  17. After I posted this I noticed that was missing from my code in this post. I guess must be some kind of code this web page uses. But, where you see a blank spot just put in there in your mind. private void PrintMenuItem_Click(object sender, System.EventArgs e) { this.pageSetupDialog.ShowDialog(); DialogResult r= this.printDialog.ShowDialog(); if(r==DialogResult.OK) { DialogResult R= this.PrintPre.ShowDialog(); if(R==DialogResult.OK) this.printDocument.Print(); } } //-------------------------------------------------------------- int =0; private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { int charsFilled=0, linesFilled=0; string text= this.RTB.Text.Substring( , RTB.Text.Length- ); e.Graphics.MeasureString(text, this.RTB.Font, new SizeF(e.MarginBounds.Width, e.MarginBounds.Height), new StringFormat(StringFormatFlags.LineLimit), out charsFilled, out linesFilled); e.Graphics.DrawString(text, this.RTB.Font, Brushes.Red, e.MarginBounds, new StringFormat(StringFormatFlags.LineLimit) ); = +charsFilled; if( < this.RTB.Text.Length) { ++ ; e.HasMorePages=true; } else {e.HasMorePages=false; =0;} } This is a very simple text printing code but when I get to the page setup dialog where I can adjust the margins and press print I get a fatal error for some reason on win98 but it prints perfecly on xp pro and I cannot see any reason why. Does anyone know what may be the cause?
  18. I just came up with a method that is much better but still does not sort right at all! I have even printed this method out and looked over it but could not find any reason why it does not work. Can someone help? Also, how do I put C# in here instead of code? public static string[] Sort_DirectoryPaths(string[] paths, char AorD) { if(paths.Length==1) return paths; string[]Pths=new string[paths.Length]; Array.Copy(paths, Pths, paths.Length); string hold=""; if(AorD=='A') { for(int i=0; i < Pths.Length; i++) { for(int j=0; j < Pths.Length-1; j++) { int shortt = 0; int longg = 0; if(Pths[j].Length < Pths[j+1].Length) {shortt= 0; longg= 1;} else if(Pths[j].Length > Pths[j+1].Length) {shortt= 1; longg= 0;} if(Pths[j]==Pths[j+1]) {} else if(Pths[j+longg].StartsWith(Pths[j+shortt]) && shortt != longg) { hold= Pths[j+1]; Pths[j+1]= Pths[j]; Pths[j]= hold; } else { for(int k=0; k<Pths[j].Length && k<Pths[j+1].Length; k++) { if(Pths[j][k] > Pths[j+1][k]) { hold= Pths[j+1]; Pths[j+1]= Pths[j]; Pths[j]= hold; k= Pths[j].Length; } } } } } } else { } return Pths; }
  19. Array.Sort() does not work for sorting directory paths in alphebetical order. I also made this loop to sort them but it does not work either: public static string[] Sort_DirectoryPathsByAll(string[] paths, char AorD) { if(paths.Length==1) return paths; string[]Pths=new string[paths.Length]; Array.Copy(paths, Pths, paths.Length); string hold=""; if(AorD=='A') { for(int i=0; i < Pths.Length; i++) { for(int j=0; j < Pths.Length-1; j++) { for(int k=Pths[j].Length, l=Pths[j+1].Length; (k<0 && l<0); k--, l--) { if(Pths[j][k] > Pths[j+1][k]) { hold= Pths[j+1]; Pths[j+1]= Pths[j]; Pths[j]= hold; } } } } } else { } return Pths; } How else can I do this?
  20. That works but it did not show up in the context menu as an auto complete. Even when I use System.Windows.Forms.ListBox it does not show up. Also, I cannot use x.Length to reference each object in the collection and there is no context menu at all when I press x then a dot. Do I need a reference or something?
  21. Ms says the listbox.SelectedItems returns a SelectedObjectCollection but this does not work: SelectedObjectCollection x= this.listBox.SelectedItems; What am I doing wrong? The compiler does not know what a SelectedObjectCollection is.
  22. private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { int charsFilled=0, linesFilled=0; string text= this.RTB.Text.Substring( , RTB.Text.Length- ); e.Graphics.MeasureString(text, this.RTB.Font, new SizeF(e.MarginBounds.Width, e.MarginBounds.Height), new StringFormat(StringFormatFlags.LineLimit), out charsFilled, out linesFilled); e.Graphics.DrawString(text, this.RTB.Font, Brushes.Red, e.MarginBounds, new StringFormat(StringFormatFlags.LineLimit) ); = +charsFilled; if( < this.RTB.Text.Length) { ++ ; e.HasMorePages=true; } else {e.HasMorePages=false; =0;} } This method works perfectly for documents that are not 82,000 characters long. The one document I have is 82,000 characters long and the print preview dialog shows the first 12 pages blank, yet the last 8 pages are okay. But even worse is when I try to print. It sends all the pages including the blanks that should not be blank and starts printing not even on the 1st filled page, which is 13, but on page 15!! What is wrong here?
  23. That brings up a good topic. Why does Ms put a char limit for a RT box and how can I overcome that?
  24. I did that at first but. . . The reason I chose to put the user pass at the point when the user clicks on the main mi is because I do not want a user who does not have the pass to even see the menu items.
  25. Anyone have an e-book like that for C#? I don't really like pdf though. If it was an html book that would be better. But either way, I am learning. Also, that e-book did not cover how to print anything but list view and plain text. Anyone know of any documentation on printing formatted text with pictures inside the text?
×
×
  • Create New...