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# .
I'm sure it is important - to you - but it's equally important that what you submit as your final project is your own work, not ours.
So if you have a problem, we'll help - but you have to show us what you have done. We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
Sent from my Amstrad PC 1640 Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
Last Visit: 22-Jul-19 14:29 Last Update: 22-Jul-19 14:29