Jump to content
Xtreme .Net Talk

Volte

*Experts*
  • Posts

    2372
  • Joined

  • Last visited

Everything posted by Volte

  1. Oh, when you remove the Run command? You need the Run command in the Sub Main of your startup object; sorry, I misread your original statement. If you take out the Run statement, then your program is never really executing; it's simply starting the program, and closing it immediately because there's nothing to do. When you use the Run command, it starts a standard Windows message loop for the window, meaning that the window becomes active, and recieves events and various window messages that are sent to it. Without a message loop and a thread to run it on, there is no program.
  2. Yes, but there should be two selections available: "WindowsApplication2.Form1" and "WindowsApplication2.Form2" If Sub Main is in Form1, you want the startup object to be the first one, otherwise you want it to be the second one.
  3. You can use a class if you want; operator overloading will work in either.
  4. Is that sub in the same form that is set as your startup object? Right click on the project in the solution explorer and click Properties. There will be a "Startup Object" setting. Make sure it is set to the same form that the Sub Main is located in.
  5. Well, there is another way you can do it with looping through every character. For example: private bool isNum(string str) { char[] chr = str.ToCharArray(); foreach (char dummy in chr) if (!char.IsDigit(dummy)) return false; return true; }Is another way to check to see if it's numeric, while private bool isChar(string str) { char[] chr = str.ToCharArray(); foreach (char dummy in chr) if (!char.IsLetter(dummy)) return false; return true; }is a way to test to see if it's letters only. Just change the 'IsLetter' function to one of the other checks (they are listed in MSDN and the intellisense).
  6. Ah yes, that's right; I keep getting those two properties mixed up. :o
  7. I believe it can be accessed through the Parent property of the form.
  8. You're welcome. :) One other thing I forgot to mention is that if you want to only execute code if a boolean is false, then you would do this: if (!someBool) { //someBool is false }
  9. Ah, booleans can be pretty confusing for someone new to programming. If statements operate solely on booleans; the block of code in the "if" is only executed if the condition in the "if" statement is true. The condition in the "if" is always a boolean. For example, in the code if (x == 6) "x == 6" is a boolean. When you use a comparison operator in an expression, the expression will be evaluated and return true or false based on, obviously, whether the expression is true or false. So basically, if (x == 6) is evaluated as if (true) is x does indeed equal 6, or if (false) otherwise. When evaluating a boolean variable, it automatically returns true or false without needing a comparison operator. Essentially, if (someBool == true) is evaluated as if ((someBool == true) == true) and that's not really very efficient. [edit]Oooops... I meant "x == 6". not "x = 6"[/edit]
  10. Put the following function in your code: private bool isNum(string str) { try { int dummy = int.Parse(str); } catch { return false; } return true; }And then you can use if (isNum(x.Text)) { int num = int.Parse(x.Text); if ((num < -1)||(num > 9999999)) { // it's valid } }
  11. if ((x < 1) || (x > 9999999)) { MessageBox.Show("x is not between 1 and 9999999"); }
  12. Yes; Main is the only sub that executes on its own (on the starting of the app). The only way to get any other subs to run is to call them (directly or indirectly) through the Sub Main (In C#... in VB.NET, you don't even need an Application.Run statement for the program to start).
  13. You have to show the form before you run the Application.
  14. I *believe* it will be able to handle a few hundred connections without any problem, but I haven't used DirectPlay in quite awhile. It's probably in the documentation somewhere.
  15. Volte

    IIf

    If there is a namespace in the framework that will do the same thing, then it is more likely better. For example, use the System.IO namespace over the functions in the VisualBasic namespace any day. However, things like constants and enumerations are definately alright to use; they are just raw values. They will behave exactly the same no matter where they are stored.
  16. Volte

    EventLog

    I not that familiar with EventLogs, but take a look at the EventLog class in your MSDN.
  17. Volte

    IIf

    Microsoft.VisualBasic is not a bad thing. Especially for just constants. You don't want to use the Functions that are provided as backwards compatibility for VB6, but constants are perfectly fine. They are exactly the same no matter where they are located in the framework hierarchy. Microsoft.VisualBasic is actually not a bad thing to use, if you use it properly.
  18. What is the icon beside the form in the solution explorer? Is it a picture of a small page with the letters 'CS' written on it, or does it look like a little form? If it's a page, then the IDE is not recognizing the file as a Windows Form.
  19. I believe you will need the resx file as well as the form (vb, cs). Click the 'Show All Files' button in the Toolbar and check to see if the form file has a little plus beside it, with a resx file under it when expanded. If it doesn't, you will have to make sure that yourForm.resx is in the same folder, and has the same name as your form. I don't know for sure if this is the cause, but it could very well be.
  20. Heh, those appear to be C++/MFC examples; also I don't believe this is what he was asking. I believe he was asking how to make the plug-in toolbars (i.e. Google toolbar). I'm not sure if this is possible in .NET; I don't know if you can make a .NET DLL interface with IE. I guess you could probably use COM, but I'm really not familiar with it. I have yet to see an example of it.
  21. That's a good attitude to have, too. :)
  22. What do you mean? You mean you did that and it doesn't work, or that it did work and you want to know why? If it did work, it's because when a textbox doesn't have focus, the blue selection is hidden; only when the textbox has focus does it appear. If it doesn't work, then I don't know what to tell you. And no, there is no way (I don't think) to do it any quicker than the way I showed you.
  23. Try addingTB1.Focus();after that SelectAll line.
  24. Just put the line wherever you want the selection to take place; make sure you're replacing TB1 with whatever the name of your textbox is.
  25. Erm... no, doTB1.SelectAll();That's all you need.
×
×
  • Create New...