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!
If you "couldn't", change your major to something you can handle. Maybe French Literature, or Janitorial Science.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
imagine this scenario:
- a tree structure is to be be built (edit/insert/delete nodes) by a group of several users
- the tree is expected to be quite large once finished (~100.000 nodes!)
- inserting, moving, copying/pasting nodes is required
- child nodes can result from individual requirements ("make a child node named A") or
from applying domain values (e.g. countries, currencies etc): "make child nodes for the
countries I select in a list".
My ideas so far:
- parent-child database table on MS SQL
- tree versioning similar to a sourcecode management system; each "check in" makes a new tree
version, so that older versions are present (for comparison, as copy/paste source)
- display in a multicolumn treeview using Infragistics Ultracontrols' UltraTree (present)
- nesting is done by parentID, and order of siblings (=children of the same parent)
is controlled by an additional integer value, so it can be changed ("move up/down").
- concurrency managment: my initial approach (timestamps for optimistic locking) could lead to
"outdated" branches, so that hours of work could not be saved, as the database status is newer
- key generation: classical parent-child-trees need keys to be referenced. Usually, I use
identity integer values in hierarchical dataset, so new nodes (-1, -2, -3) get their IDs on
dataset.Update, but here, the reference is recursive (not just hierarchical). Creating a branch
has to create the nodes "top down".
Of course, if a commercial solutions provides a way to edit/manage a huge tree with several users, I'd be glad not to have to reinvent the wheel.
That's not hard to ... imagine. But, imagining a single developer implementing this ... who is not already a wizard with an advanced DB that supports the features you describe ... that's hard.
There's lots of $ implementations out there: at the low end, checkout TreePad.
You might look into graph databases like Neo4j, or Amazon AWS Neptune (cloud), if you foresee the need for a highly connected set of entities where creating/manipulating linkages between nodes is critical.