Recent content by jmcilhinney

  1. jmcilhinney

    how to transfer data to two different tables in one single query

    To answer the question you asked, it would depend on the database you're using but probably not. Even if there was, you shouldn't do it. In other news, even if you think that you are safe in the first case because your values are coming from ComboBoxes, you should still be using parameters...
  2. jmcilhinney

    Resolved how to check if datagridview is empty

    @JohnH's suggestion is probably all you need but, for the sake of completeness, a solution that would work whether AllowUserToAddRows is True or not is as follows: If Not myDataGridView.Rows.Cast(Of DataGridViewRow)().Any(Function(row) row.IsNewRow) Then 'The grid contains no populated rows...
  3. jmcilhinney

    AES Encryption of a string

    The AESEncryptStringToBase64 method accepts the text to be encrypted and returns the encrypted data as text in base-64 format. If you have a file then you can call File.ReadAllText to get the plain text. What you do with the encrypted text is up to you, e.g. call File.WriteAllText to write it to...
  4. jmcilhinney

    Resolved Search data between two dates and by Customer name

    Note that the 50 used in the parameter code is the size of a variable-width column. You should use the size of your column, whatever that may be.
  5. jmcilhinney

    Resolved Search data between two dates and by Customer name

    First of all, is there a good reason to have separate controls for date and time? A DateTimePicker will display both and allow you to set both. The only advantage I can see that separate controls would provide would be the ability to display a drop-down calendar for the date and spin buttons for...
  6. jmcilhinney

    Resolved AES Decyption

    It's the same code either way. A function is simply a way of making a chunk of code reusable. You identify the variables and extract those as method parameters and the rest of the code remains the same. This is true of any code, not just decryption code. Either you know how encryption/decryption...
  7. jmcilhinney

    Resolved AES Decyption

    Do you understand how encryption works in .NET? If not, that should be your first task. Copying code off the web with no understanding of what that code does is rarely a good idea. That method fairly obviously takes the path of an encrypted file and returns the decrypted data as a Byte array. If...
  8. jmcilhinney

    Question How to display the win 10 calculator history?

    Just apply a bit of logic. If you had a numeric variable X and you wanted to add Y to it, would you expect X = Y to work? I certainly hope not, yet that's exactly what you're doing in your current code.
  9. jmcilhinney

    Question How to display the win 10 calculator history?

    If your intent is to display text then your first choice should be a Label. If you need to accept input too then obviously you need a TextBox. If you don't want to accept input but you want the user to be able to copy the text that is displayed then a TextBox with its ReadOnly property set to...
  10. jmcilhinney

    Resolved Merging multiple files into one using filestream

    https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/using-statement
  11. jmcilhinney

    Resolved Merging multiple files into one using filestream

    Is it though? Of course bigger files are going to take more time to process but it's not slow if it's a linear or close-to-linear increase. If increasing the file size ten times increases the time taken ten times then that's not slow; it's exactly the same speed. You're going to have to provide...
  12. jmcilhinney

    Transfer data from combobox to columns with condition

    Firstly, it's good that you tried to use parameters but I'm afraid you failed. You are still concatenating values into your SQL so the parameters you add will be ignored. The idea is that you use placeholders in the SQL rather than values and then the values are obtained from the parameters by...
  13. jmcilhinney

    Resolved Merging multiple files into one using filestream

    That's far closer to what I would suggest but there are still improvements to be made. A counter variable of type Double is wrong. Counting is, by definition, performed using integers. As such, that variable should be type Integer. It seems not to be being used anyway. A variable intended to...
  14. jmcilhinney

    Resolved Merging multiple files into one using filestream

    Unless this is homework and you were required to write it, that `CopyStream` method is quite unnecessary. The Stream class already has a CopyTo method. If you are required to write your own method, part of the problem is that that method closes the Streams. The name of that method is CopyStream...
  15. jmcilhinney

    Resolved Merging multiple files into one using filestream

    What does FileMode.Create actually mean? Have you looked?
Top Bottom