Jump to content
Xtreme .Net Talk

mutant

*Experts*
  • Posts

    1922
  • Joined

  • Last visited

Everything posted by mutant

  1. To load it back into the textbox simply use System.IO.StreamReader class, it will provide with needed methods. Right after you close the stream you could show a messagebox with the text you want using MessageBox.Show("text").
  2. As far as I know (I could be wrong as I never looked into this stuff) the only limit would be the memory, and then when no more handles can be created you will receieve an error and no more controls will be created. (you can try that, simply create a long loop and keep adding controls to the form)
  3. The file is empty because you never close or flush the stream so the data written to the stream won't make it to the file. Add both of those statement to your code: FileWriter.Flush() FileWriter.Close()
  4. This method is much better: If Not Char.IsLetter(e.KeyChar) Then e.Handled = True End If The shared method of the char will tell you if the character is a letter, lower or uppercase.
  5. If you do not want the users to enter letters then you can check the if the key pressed was a number using the IsNumber shared method of the Char. Then you pass in the keychar passed into the event. If Not Char.IsNumber(e.KeyChar) Then e.Handled = True End If
  6. Why would you need to override those properties?? If they are not makred overridable then you can't. Are you trying to find out when the control is moveed or resized? If that is the case, Resize and LocationChnaged events will do that for you.
  7. How did declaring an array of classes did not work? DId it give you errors about members not being initialized or out of bounds excpetions? To get this done you could easily use an arraylist because you don't have to worry those errors: Dim vars As New ArrayList 'add something to the array list vars.Add(New SwitchClass) vars.Add(New SwitchClass) 'Loop through each object in the array list For each sc as SwitchClass in vars sc.Position = this sc.IsOn = false next When you say that something doesnt work with the array, please explain more as it will be MUCH easier to come up with an answer. For example now, I don't know if im giving you the answer you are looking for because I don't know what is wrong.
  8. The ProcessStartInfo class will provide you with an option to get the output from a console app. Then you can pass in the ProcessStartInfo class into the Process.Start method. Dim pi As New ProcessStartInfo("cmd.exe") pi.RedirectStandardOutput = True pi.UseShellExecute = False 'required call to redirect streams Dim p As Process = p.Start(pi) p.WaitForExit() MessageBox.Show(p.StandardOutput.ReadToEnd()) 'show what the application tried to print onto the console Now this will get all the text that the application would normally print ou to the console and put into the stream instead, thus nothing will print on the console itself.
  9. You mean you were using controls in multi-threaded environment? Control and not thread safe so you shouldn't do that. As for DirectInput, you can only set the cooperative level to a form. Im not sure what is the probelm you are describing.
  10. I don't have the same problem. Could you maybe attach some code you use?
  11. Are you looking for something like this? Im not entirely sure what you need. 'define some class Public Class MyOwnProperty 'declare some vars private _width as Integer private _height as integer 'now declare properties Public Property Width As Integer Get return _width End Get Set(ByVal Value As Integer) _width = Value End Set End Property Public Property Height As Integer Get return _height End Get Set(ByVal Value As Integer) _height = Value End Set End Property End Class 'and now use this class as a readonly property Public Class ClassToUseProperty 'declare the previous class that was made private _myproperty As New MyOwnProperty 'And use the object as a read-only property Public ReadOnly Property TheProperty As MyOwnProperty Get return _myproperty End Get End Property End Class
  12. Can you maybe show a screenshot or some sample code that would illustrate the problem you are having? That kind of setup works fine for me.
  13. Are you talking about DirectPlay?
  14. What doesnt work in it? It can't connect? Throws an exception? One thing that I noticed at the first look is that you don't set an application description properties whatsoever, for example you don't set a GUID, your application will not be able to find another one on the specified IP.
  15. Is the service provider available on your computer? You don't have to work with different types any differently, DirectPlay does that for you.
  16. You can use the Manager class from the Direct3D namespace to get some basic info about the card from the drivers. Then using the Adapters property (use 0 for default adapter), and then using the Information property of the Adapters property. (:)) Manager.Adapters(0).Information.Description For example this will return the description of the card, which in most cases is the name and the model number of the card.
  17. No updates are planned for the AudioVideoPlayback namespace, neither functionality or documentation. Thats why the version is still the same with the summer update. You could write out the stream to a file and then use it, probably your only way.
  18. Well, command line arguments are combined into one string of text (spaces usually divide those). What you could do it make another special character that will represent how many numbers of the next ones will fit into a particular array, something like: C:\appname.exe -count 2 234 234 Of course you could do that any way you want.
  19. Usually command line arguments are divided by a space. You could pass in every argument separated by a space, and then use System.Environment.GetCommandLineArgs() method to get the array of strings representing the passed in arguments. The 0 index will always be the file name of the exe so you might as well skipt that.
  20. I would recommend that you make yourself familiar with the C# keywords first. To do that open up the .NET Framework reference and search for "keywords, C#". You will see a list of results and one of the few top ones will take you to the page which in turn will take to keyword list, and beginner tutorials.
  21. To get the icon into the system tray use the System.Windows.Form.NotifyIcon class. Then you have to add a context menu object to the icon, using the ContextMenu property orf the icon. Dim mnu As New ContextMenu mnu.MenuItems.Add("Hello") 'there is also an overload that accepts an event handler so you can use that trayicon.ContextMenu = mnu You also will have to set an icon image for the icon. trayicon.Icon = new Icon("path") Also, you have to make it visible. trayicon.Visible = True Now, to make that happen, you can start your program from sub Main. Forst declare the tray icon and the menu, then use the Application.Run() method to start the message loop for your app.
  22. You can utilize the Delete method of the file class, and the StartupPath property of Appllication object which contains the path of your program. IO.File.Delete(Application.StartupPath & "\filename.ext")
  23. The close method of the form automatically calls dispose.
  24. If you know the name of the object you can create an instance of it using Reflection: 'Get the DLL Dim dll As Reflection.Assembly = Reflection.Assembly.LoadFrom("dll path") 'Create an instance of the specified object Dim yourobject As Object = dll.CreateInstance("type name")
  25. Are you doing the drawing in the Panel's Paint event or the Form's Paint event? If you do it in Form's Paint, the panel will be drawn over what you drew.
×
×
  • Create New...