When you use <pre> tags, please make sure you select the correct language from the dropdown list that appears when you click the code button above the edit box. And also make sure that the checkbox marked "Treat my content as plain text, not as HTML" below the edit box, is unchecked.
We can't give you exact instructions because we have no idea how you are building yout strings, but if you want specifically formatted output, you have to specify that when you build the string.
There are a couple of ways to do that.
For string values, you can use PadLeft:
somewhat OT, but, I have always found this behavior of PadLeft weird:
A new string that is equivalent to this instance, but right-aligned and padded on the left with as many spaces as needed to create a length of totalWidth. However, if totalWidth is less than the length of this instance, the method returns a reference to the existing instance. If totalWidth is equal to the length of this instance, the method returns a new string that is identical to this instance.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
OK, now you're going to have to explain what you mean by "it doesn't work". That's not a valid problem description.
What DOES happen? What error messages do you get?
In a quick glance, how you're building your SQL INSERT statement is horrible and prone to many problems and even destruction of your entire database. Google for "SQL Injection Attack" for why it's so bad, and then Google for "C# SQL Parameterized queries" for discussions and examples of how to do it correctly.
I'm guessing here, I think your filldatagridview() method only works well once; when you execute it again, it assigns the same DataTable object (possibly with a different content, but that is irrelevant here) as the DataSource to your DGV, hence the DGV doesn't know something should change.
Could somebody give a good advise for the following :
I am an aspirant in learning c# and I wish to make a GUI that can read canbus J1939 engine data to read RPM .
I could read the can-bus data by tapping to the vessels engine can bus using a can to USB converter called kvaserCAN. I do understand the PGN data frames for the bytes 4 and 5 need to mathematically applied to find the product with .125 rpm / bit to get the right rpm. (byte 4 being the least )
basically how can we tap the can info on the USB port that does not fall on the usual com port but on the kvaser com port as we see it using the device manager.
appreciate if a sample code be shared to start bit by bit programming to be used on a C# .