Jump to content
Xtreme .Net Talk

mutant

*Experts*
  • Posts

    1922
  • Joined

  • Last visited

Everything posted by mutant

  1. The sender argument is an object argument, in case of controls a control instance is passed into the sender argument. Casting the sender object should work. What errors does it give you? If people at your school successfully used Sender.Focus() without doing anything to the objecty it means they dont use Option Strict which is a bad mistake.
  2. If you didn't draw the lines in the paint event, they will be earased. If you want to redraw them if they disappear then simply paint in the Paint event.
  3. Visit this thread, it will explain why you cant at this point :) http://www.xtremedotnettalk.com/showthread.php?s=&threadid=49561
  4. You would have to use MouseDown or MouseUp event, whichever one you want and use the arguments that are passed into it to check what button was pressed. 'in one of those events... 'check what button was pressed If e.Button = MouseButtons.Right Then 'do what you need to do when right button pressed End If
  5. You can read a file using the IO::StreamReader object. Here is an example: //create a new StreamReader object and pass in the path to the file System::IO::StreamReader* r = new System::IO::StreamReader("path to the file"); //create a string variable to hold the value that you read from the file //in this example you are only reading one line because ReadLine() method is used String* fcontent = r->ReadLine(); //close the stream r->Close(); This how you can read it, how you get out the info from the file is what you have to think of, it depends on how you format your file, where you put what and things like that. If you want to write to a file use IO.StreamWriter class. Here is an example: 'create a new StreamWriter object and pass in the path to the file to it System::IO::StreamWriter* w = new System::IO::StreamWriter("path to the file"); //now you can write to the file using WriteLine or Write method w->WriteLine("This is a text"); //then you have to flush the sream to make sure everything is in the file now w->Flush(); //and close it w->Close();
  6. I would recommend using Regions for forms that are not rectangluar. If you need an example just say :)
  7. The application exits when you terminate the main form becasuse the message loop of your app is dependend on that form. You dont need a module to not directly start with a form. The only thing you need is Shared Sub Main someinwhere in one of your classes: Shared Sub Main() 'do whatever you want when there is no forms or show them. End Sub [\vb] But, if you start a message loop for your form from there it wont make a difference, the application will still be dependent on it.
  8. You have to convert the string to a double: Grade1 = Double.Parse(strStudent.Substring(12, 4)) 'OR Grade1 = Convert.ToDouble(strStudent.Substring(12, 4)) Do not forget to enclose those in a Try Catch statement as if the string in not in a correct format, it will raise an error.
  9. Release mode does not contain debugging info like that. Thats why its faster, its freed of all that info that is required for debugging.
  10. A better way, and a .NET way would be to make overloads. Here is an example: Private Overloads Sub createNew(ByVal text As String, ByVal number As Integer, ByVal buttonSelected As System.Windows.Form.Button) 'do whatever you need to when the button is instance is passed in End Sub Private Overloads Sub createNew(ByVal text As String, ByVal number As Integer) 'do whatever you need to when a button is not passed in End Sub
  11. You are declaring a Form object, which is blank indeed. You need to create an object of the type you created. If your form is called Form2 then declare it like this: Dim f2 As New Form2 'not Form but Form2
  12. If you want to open a new form when a checkbox is selected then simply checking for the value in the CheckChanged event would do it. And then: DIm formvar As New FormType formvar.Show() Or if this is not what you are looking for, could you please try to explain your problem again?
  13. If you want to start a program then you can do it by using the System.Diagnotics.Process class, and its Start() method. To pass in aguments to that program right after the exe path type them in, when using the Process start method. To retrieve those you can use the following System.Environment.CommandLine and System.Environment.GetCommandLineArgs, which return the whole command line or command line divided into a string array, respectively.
  14. This is probably what you are looking for: http://www.xtremedotnettalk.com/showthread.php?s=&threadid=49597
  15. What line does it fail on? Are you sure that you point it to the right registry path because that code works, and the exception you get is thrown when there is no path like the one you specify.
  16. See if the Enabled property of a control is what you are looking for. YOu can then manipulate the enabled to true or false depening if the user enters something in the field above. :)
  17. J# has an ability to work with ZIP files, but you would need an additional redistributable for J# installed additionally to .NET Framework, you could use it from a DLL. But what Nerseus mentioned is a better way of doing it :).
  18. It probably is, it returns True when the surface is working all right.
  19. You are trying to convert a number to a string, right? double d = 13450; string s = d.ToString(); //ToString() method will convert it to a string for you
  20. mutant

    Namespace

    Everything needs to be in a namespace. If you only have one class it needs to be in one too, but the persion simply created a new one instead of putting the class in any other namespace.
  21. The process would be the same except that you would need to get to instance of the form you want to add controls to, to the method that creates them. For example pass it in as a parameter to the method.
  22. Is this article what you are looking for? http://www.elitevb.com/content/01,0096,01/
  23. This will return the .NET version for you: System.Environment.Version You can get the version in pieces like major, minor, build or the whole version. To use it as a string you would simply use the TOString method. IE 5.1 (I think thats the one) is required for framework and every Windows ships with IE so you shouldn't have problems there.
  24. mutant

    namespace

    Where did you put it? The code above needs to be above any classes, on the top of the code.
  25. What control are trying to do that to?
×
×
  • Create New...