Search results

  1. jmcilhinney

    Resolved "System.NullReferenceException" error when combobox1.items.add

    We're happy to help but please be sure to do appropriate debugging before posting a question. That would have revealed the issue without your having to post a question at all. Perhaps you weren't aware of what was actually involved in debugging but hopefully now you are.
  2. jmcilhinney

    Resolved "System.NullReferenceException" error when combobox1.items.add

    A NullReferenceException is one of the easiest exceptions to diagnose because the process is always the same. When the exception is thrown, simply use the debugger to examine every reference on the offending like to determine which one is Nothing. You then work backwards to where you expected...
  3. jmcilhinney

    Question How do I add commas in numbers automatically?

    I can't see any reason that using Val would do that. It sounds like something is broken somewhere. Please provide step-by-step instructions on how to reproduce that issue and we can see whether we can, indeed, reproduce it. There's no need to hit Enter. You should probably be handling the...
  4. jmcilhinney

    Question How do I add commas in numbers automatically?

    As I have said, if you want to format a number then you need to have a number. In my example code, I used numbers. The Text of a TextBox is a String, not a number. You need to convert the String to a number first. Val will do that, although it's a bad way to do it.
  5. jmcilhinney

    Question How do I add commas in numbers automatically?

    You should set Option Strict On in the project properties and also in the VS options, so it will be On by default for all future projects. That will pickup issues with data types like this at compile time instead of letting them through to run time. That will force you to write better code.
  6. jmcilhinney

    Question How do I add commas in numbers automatically?

    You previously had this: Dim val1 = Val(TextBox1.Text) and now, for no apparent reason, you have this: Dim val1 = TextBox1.Text That means that val1 is type String and there is no such ToString method on that type. You can't format a String as though it were a number. If you want to format a...
  7. jmcilhinney

    Question How do I add commas in numbers automatically?

    Visual Studio has a debugger built in. You should use it.
  8. jmcilhinney

    Question How do I add commas in numbers automatically?

    Mind you, if you were to use code like that on the TextChanged event then it will always remove the decimal point unless the user enters the digits to the right of it first, so there's that. A proper implementation of a numeric TextBox is actually very complex, which is why it's better to simply...
  9. jmcilhinney

    Question How do I add commas in numbers automatically?

    If you want to format a number and include group separators and an optional decimal point without truncating the decimal, you can use something like this: Dim a = 0.0 Dim b = 1.0 Dim c = 123.0 Dim d = 1234.5678 Console.WriteLine(a.ToString("#,0.##########"))...
  10. jmcilhinney

    Question How do I add commas in numbers automatically?

    Your KeyPress code does not prevent the user entering multiple decimal points or multiple negative signs and it doesn't prevent the user pasting anything at all into the control.
  11. jmcilhinney

    Question How do I add commas in numbers automatically?

    We've obviously interpreted the request differently. Hopefully the OP can clear up the confusion with a full and clear explanation of the problem.
  12. jmcilhinney

    Question How do I add commas in numbers automatically?

    Your implementation is way too simplistic to do what you want. That's not completely true. I think that the aim here is to format the data as it is entered and to allow a variable number of decimal places, neither of which the NumericUpDown will do. @love_lyn99, assuming I'm right in my...
  13. jmcilhinney

    Question Removing extra line feeds in double quoted fields

    You can use a TextFieldParser to read the data as records, even if it contains line breaks. You can then remove line breaks from individual fields. You'd then have to reconstruct the record, adding in appropriate quotes. E.g. Dim lines As New List(Of String) Using parser As New...
  14. jmcilhinney

    Resolved output of .Location.X/.Y is not accurate?

    Don't do this: ShapeContainer1.PointToScreen(New Point(RectangleShape1.Location.X, RectangleShape1.Location.Y)) That Location property already is type Point, so just use that as I already demonstrated.
  15. jmcilhinney

    Resolved output of .Location.X/.Y is not accurate?

    Given that CopyFromScreen can copy anywhere from the screen, it stands to reason that the source coordinates are relative to the screen. Is RectangleShape1.Location relative to the screen? No it is not, so it's not going to work as you desire. You need to translate that Point to screen...
  16. jmcilhinney

    Resolved How to use .PaintPicture in VB.NET?

    Why would you be drawing PictureBox2 to an Image and then displaying that Image in the same PictureBox2? Surely you should be drawing from one place and displaying somewhere else. Also, never just say that something doesn't work. That could mean anything. Explain EXACTLY what happens and...
  17. jmcilhinney

    The code will fire every 60 minutes and 1 minute for 24 hours

    I really do wonder what people search for at times, that they can supposedly find no information on common topics. There is a ton of information available on the web and being able to search for it effectively is a critical skill for any developer that takes no development skill or experience at...
  18. jmcilhinney

    The code will fire every 60 minutes and 1 minute for 24 hours

    What have you done and where are you stuck?
  19. jmcilhinney

    Resolved How to use .PaintPicture in VB.NET?

    What is "the .PaintPicture"? You seem to be referring to something specific without explaining what it is. Try harder. Saying you're bad at explaining doesn't get you off the hook. It's not for us to do the work to interpret your bad explanation. Try using more words, instead of as few as...
  20. jmcilhinney

    Question drop link from chrome

    Like I said, you're not going to be able to use FileDrop as the format because the browser doesn't make the data available in that format. I've shown you how to see which formats are available and how to get the data in each of those formats. You need to examine the data in each case, determine...
Top Bottom