Jump to content
Xtreme .Net Talk

Volte

*Experts*
  • Posts

    2372
  • Joined

  • Last visited

Everything posted by Volte

  1. MenuItem1.Shortcut = Shortcut.AltF4Or if you mean to change the mneumonic, just change the caption property, and put an apersand (&) in front of the character you want to mneumonicize. :)
  2. Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing If continue = False Then e.Cancel = True Else Me.Dispose() End If End Sub You need to set e.Cancel = True to make it stop closing.
  3. You can use a For Each to cycle through all open MDIForms and check to see if it's an instance of the particular form using (I think) the TypeOf operator (If TypeOf theForm Is Form2 Then theForm.Focus(), or something similar).
  4. The object doesn't necessarily need to be on the screen. It's the pointer to an object that is loaded into memory; it can be a button, a form; anything that Windows classifies as a "window" will have an hWnd (a Window Handle, the Handle property in .NET). There isn't as much need to use it in .NET, but it is still required for many APIs for which there are no .NET replacements.
  5. My computer has two monitors, and it does allow me to resize it larger than my main monitor. If I set the width and height to 8000x8000, then it goes just a little bit lower than the screen, and it fills up both monitors. It just won't go bigger than both monitors combined.
  6. It's probably not taking into account the form borders or something. Anyway, why would you want to set the form larger than the screen? That can't be a very good idea for a regular application, anyway. :-\ Still, it doesn't look like you can do it with .NET alone. You might be able to do it with API. Try looking at the [api]SetWindowPos[/api] API.
  7. If you're serializing to binary, then it won't be a human-readable textfile in the end. Here is an example of serializing to XML: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim sa() As String = {"Extreme", "Visual", "Basic", "Forum"} Dim ser As New Xml.Serialization.XmlSerializer(GetType(String())) Dim fs As New IO.FileStream( _ Application.StartupPath & "\beh.txt", IO.FileMode.OpenOrCreate) Dim tw As New IO.StreamWriter(fs) Dim tr As New IO.StreamReader(fs) ser.Serialize(tw, sa) Dim dum As String, ret() As String, out As String ret = ser.Deserialize(tr) For Each dum In ret out &= dum & " " Next MessageBox.Show(out.Trim) End SubThere is lots of documentation in the MSDN regarding serialization, when to use it, and how to use it. I would suggest giving it a good once-over. The Xml.Serialization namespace is the key to XML serialization, so check out the docs on it.
  8. Just don't use End! Me.Close() will do just fine.
  9. Use a DataGrid control with a disconnected dataset to achieve this. It has been discussed very recently in the forums, so do a search.
  10. VB6's CommandButton never had that; you are thinking of the CheckBox. If you set the CheckBox's 'Appearance' property to 'Button', it will be a toggle button.
  11. From what I've heard, I would stay away from the Standard Edition; it doesn't seem to provide a readily available way to create usercontrols (or some similar limitation). I believe there is some kind of work around available in the Code Library or Tutors Corner, but it's not a full fledged solution. VB.NET Standard might be good for beginners, but if you want to be a serious .NET developer, I'd get at least the pro version.
  12. You will need to create a borderless form at the correct size you want and with the proper designs and whatnot on it, and then show it using the ShowWindow API in the corner of the screen. Use the following declaration for ShowWindow: Declare Function ShowWindow Lib "user32" (ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer Const SW_SHOWNA = 8 To show the alert window, use Dim alertWin As New frmAlert() 'frmAlert is your alert form ShowWindow(alertWin.Handle.ToInt32, SW_SHOWNA)You need to use the alertWin.Location property to move the form before the ShowWindow line. You can get the size of the screen by using the Screen.PrimaryScreen object. I believe the GetBounds method is what you need.
  13. Me.pbLogo.Image = Image.FromFile("Path Goes Here")
  14. If you use VB6, this is not the forum for you; http://www.visualbasicforum.com. And no, if want to use VB.NET, then #Develop doesn't have any libraries that will allow you to do that. You need to set the menu to OwnerDrawn yourself.
  15. Welcome to the forums, Threads. :) What an appropriate name! ;)
  16. It's an API that can be used in any language supporting them (including .NET). Here is an example of enumerating all the drives and printing them and their free spaces: Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, ByRef lpSectorsPerCluster As Integer, ByRef lpBytesPerSector As Integer, ByRef lpNumberOfFreeClusters As Integer, ByRef lpTtoalNumberOfClusters As Integer) As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim drives() As String = IO.Directory.GetLogicalDrives() Dim drv As String For Each drv In drives Dim spc, bps As Long Dim free, total As Long Dim freeBytes, totalBytes As Long GetDiskFreeSpace(drv, spc, bps, free, total) freeBytes = spc * bps * free totalBytes = spc * bps * total ListBox1.Items.Add(drv & " Space: " & freeBytes & " / " & totalBytes) Next End Sub
  17. Try looking here: http://www.allapi.net/apilist/GetDiskFreeSpace.shtml
  18. Volte

    DataGrid

    I haven't tested it, but you could try:DataRowCollection r = ds.Tables["StuffTable"].Rows; foreach (DataRow dr in r) { //do stuff with the datarow }
  19. If you use the DownloadData method on a web address, it will download the HTML source into a byte array. It won't (at least, it shouldn't) send out anything but the HTML.
  20. That would be the one. Thanks wyrd. :)
  21. I believe there is a special utility that you can get to do it... what it is I don't know; I'd be interested to know, though.
  22. You can change the auto-formatting in the IDE options. Text Editor -> C# -> Formatting -> Leave open braces on same line as construct. To add events click the control, and in the property window, click the lightning bolt to change the properties to a list of events. Then type the name of the delegate sub into one of the Events and press enter. That wires the event up for yoo.
  23. Definately there is. Create a boolean variable, like this: bool doClick = true;at the top of your form (above all subs and functions), and then in the click event, do it like this: private void pictureBox1_Click(object sender, System.EventArgs e) { if (doClick) { // do whatever you need to do in the click event doClick = false; } }Set it back to true if you want to re-enable the button.
  24. I meant that in C# you do need it, but in VB.NET you don't. Yes, Application.Run(); is correct. Sorry for being unclear.
  25. I'm not totally sure if this is a great way to do it, but it's one way. If you want to stop the code in the click event from firing, you could simply unhook the event handler for the click event. The code: pictureBox1.Click -= new System.EventHandler(pictureBox1_Click);Will stop all click events from being processed and sent to the 'pictureBox1_Click' sub.
×
×
  • Create New...