Jump to content
Xtreme .Net Talk

snarfblam

Leaders
  • Posts

    2156
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by snarfblam

  1. I would much rather run use a standard Windows command than add an extra dependancy (and extra code) to my project, but that's just me.
  2. Are you using it under the correct circumstances?
  3. You may need to detatch event handlers. How you do it depends on how the event handler was attatched in the first place. If you use the Handles clause (or created a handler with the IDE) you need to set the variable to Nothing so VB removes the handler. Ball1 = Nothing If you used AddHandler, use the RemoveHandler keyword like so... 'Substitute appropriate event RemoveHandler Ball1.Click, AddressOf Ball1_Click [/code]
  4. Can you invoke subst.exe (system32 program) through the shell to do this?
  5. The parentheses make the difference between a function/property, i.e. public int Function(){ } public int Property{ } In a property, you provide two (or at least one) accessor functions name get and set (very similar to VB). int _Property public int Property{ get { return _Property; } set { _Property = value; } } You can omit one or the other to make read-only or write-only properties. VB is very lax with parentheses and always adds them for you when you forget them. If you keep using C# you will notice lots of places where VB throws things in or auto-corrects for you that C# doesn't (usually because it can't, for example, adding parentheses for you will turn a property into a function).
  6. How are you referencing the PictureBox? If you want to remove it by the name used in the designer, code like this will work fine: 'Substitute the actual control's name for PictureBox1 Me.Controls.Remove(PictureBox1) Or an event handler... Private Sub PictureBox_Click(sender As Object, e As EventArgs) _ Handles PictureBox1.Click, PictureBox2.Click, PictureBox3.Click Me.Controls.Remove(DirectCast(sender, Control)) End Sub You'll want to call the Dispose method of the control if you are done with it for good.
  7. A bit harsh, no? To be fair, I've been programming for over ten years now, but I've never written an n-teir application, and I wouldn't be sure where exactly to put the classes either. I might not be Einstein, but I'm no moron either. I'd say it's a fair question. The classes have to go somewhere, and it is only natural that one should wonder if there is a specific place they should go.
  8. An important thing to understand is that Microsoft is already preparing for web development competition. They've released their Express edition software for free (as far as I know it was supposed to have become a pay-for product by now, but it's still there for all to download). They've also distributed free compilers for VB, C#, and C++, as well as an open-source .Net implementation, and there are plenty of open-source IDEs for all three languages (and more). If you can't beat 'em, join 'em, I guess. If they fight the concept of open-source, they'll lose, so they're doing the best they can with it, and they aren't doing half bad. Microsoft's biggest advantage is their pre-existing clout. People will continue to use Microsoft because so much of the world runs on Microsoft, and Microsoft tends to make a point of maintaining incompatibility with their technology and the rest of the world's to make the switch from Microsoft to open-source or another software developer increasingly difficult. And yes, they fell behind a little bit, but they've been stepping up and delivering better and better lately and I think they will catch up. As far as open-sourcers stepping out of the ashes, yes, they will always be there and they will always have their place, but so will commercial software. As much as I would like to see a thriving "communist" (or open-source if the term communist offends you) world of computing, the fact is that the world of computing is primarily commercial and will stay that way for as long as I can see.
  9. The first thing I can think of off the top of my head, but this would require some research, P/Invoke, and experimentation, is to use the Windows API to find the error window, then get the handle to the "Don't Send" button, and send it a click message to simulate a mouse click, causing it to close. There could be something simpler... I don't know.
  10. Fair enough. Definitely looking into it, but I think the sort of programming I do is very recreational. Not simply in that it is a hobby, but that it doesn't matter if it's already been done or even really whether or not people will find practical uses for it (but I suppose that helps); it is more about just making something and having fun doing it. I suppose SourceForge would be more appropriate than a find-a-programming-friend forum, but I suppose I'm just interested in something more casual. Besides that, I'm still curious as to whether people program for work or strictly for fun. P.S. By the way, I guess plenty of people share your sentiment with the "my job is my hobby" attitude. So far everyone who has voted for work has also voted for hobby.
  11. Oops. My bad. I guess I can't read. I couldn't tell the da's from the ds's.
  12. Do you program as a hobby? For work? Or both? I'm a hobbyist programmer. The only time I've ever even worked with another person programming was in a VB class in high school, which turned out to be a joke of a class. I have considered involving other people in the larger programming projects I've started (sometimes I dive into things that really shouldn't be a one-person-job), but I really don't know many programmers who I could ask. I've considered posting a recommendation in Suggestions, Bugs, and Comments for a forum for finding people to help with small/medium scale non-profit programming projects , but it occured to me that a good deal of programmers on these forums could be strictly professional programmers, so I wanted to see if it would be worth the effort.
  13. Maybe it has something to do with the fact that you dim the same variables more than once.
  14. Well... you could actually paste the same exact code into the FormClosing event handler. Setting e.Cancel to true would prevent the form from closing and give you a chance to communicate the issue to the user.
  15. Are the files being saved over? Newly created? Any copying? And the best way to determine which events are being fired is to handle them. You can throw a MessageBox or something in the handler to tell you that the event was fired.
  16. I don't have a direct answer to your question but you need to realize that the Graphics class is a bit slower than GDI. This is particularly applicable with blitting functions, especially when many small images are drawn, as opposed to a few large images. Depending on your exact needs you might want to consider moving to GDI or double buffering your control.
  17. Have you tried removing the VBFixedArray attributes? The marshalling problem is most likely related to the arrays. These are the kinds of problems you run into when you use the VB6 code upgrade tools that come with .Net.
  18. You could have your collection object track any open enumerators and throw an exception when something is added or removed while there are open enumerators. You could also have the collection object raise an event when something is added/removed and have your enumerators handle the event.
  19. Dotnet might be more finicky than VB6. Also, remember that a Long in VB6 is an Integer in VB.Net. You might want to look around for some tutorials for this. I'm sure you've already read at least one or two, but they might have missed a detail that VB6 tolerated, and there are plenty of them out there so you can cross reference them.
  20. What are you looking for, specifically? The ImageIndex of the selected ListViewItem? Does this help? 'If user clicked with right mouse button ' and there is one and only one item selected ' and that item has an image index of five then... If e.Button = Windows.Forms.MouseButtons.Right _ AndAlso ListView1.SelectedItems.Count = 1 _ AndAlso ListView1.SelectedItems(0).ImageIndex = 5 Then 'Like, do things, and stuff... End If
  21. I experience this kind of behavior alot in C# Express (and have experienced it from time to time in VB standard 2003) when creating Windows Form Controls. The controls can work perfectly at runtime, but when you switch tabs or click a different window in the IDE the whole thing dissappears. I have a tendancy to forget the save button, especially with temporary projects, and have lost hours of work a few times when the IDE vanished. I actually lost a few days worth of work this way once. I scoured the hard drive for any copies of my code in temporary folders but instead managed to find an EXE which I had to decompile to get my code back, sans comments, for loops, XML code comments, etc. Unfortunately I have no clue as to why it happens or how to fix it.
  22. Well, it might be easier to answer your question if we see some code, but basically, if you need to do validation you can use the validation events. For example, if you want to make sure that a text box contains a number before the form is closed, you could handle the Validating event, like so... Private Sub TextBox1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating Dim i As Integer 'TryParse will return false if the number can't be parsed, i.e. is not a valid number If (Not Integer.TryParse(TextBox1.Text, i)) Then 'If the number is invalid.... 'Set e.Cancel to signify this and keep focus on the textbox e.Cancel = True 'Tell the user MessageBox.Show("Number is not a valid integer") 'You could also use a component like ErrorProvider to let the user know 'that their input is invalid End If End Sub
  23. Which event(s) are being fired, and how are the files being created/placed?
  24. If you need to access an image file repeatedly you can not use the constructor overload that accepts a filename or the Image.FromFile function. Whether by design or as the result of a bug, the image file is not freed for access (at least not for write access, not sure about read access) until the image is finalized (not when it is disposed). An easy workaround for this is to create a FileStream on the image file and pass this FileStream to the Bitmap constructor instead of using Image.FromFile. Immediately after creating the Bitmap object, close the FileStream to free it up to be deleted/read/written again.
×
×
  • Create New...