I'm trying to use a listbox as my invoice layout. (so I'm adding new items to the listbox for the invoice)
is there a way to append text to one line in the listbox? or a different way? or a different control that I should be using?
So what I mean is...
Ex.
I have a label with the column headings.
"TEM DESCRIPTION PRICE QTY BO AMOUNT
Then I need to add Items to the listbox as follows..
ITEM DESCRIPTION PRICE QTY BO AMOUNT
9999 CD PLAYER 200 1 0 200
88887 AMPLIFIER 200 1 0 200
I always need the colums to start at the same position...so if the ITEM #'s are not the same length, DESCRIPTION should still always start at the same spot??
I wouldn't use a listbox for this functionality, I'd use a Datagrid and translate your data into a dataset. If you don't want any db backend then just use xml and a schema. OR if you have something against datagrids then I'd use at least a ListView which has columns that you can work with individually.
I was going to use a datagrid..but when I goto print them invoice I'm thinking that it wouldn't look very good, with all the datagrid lines between all the items!!
And how would I use a listview to implement this. I'm unfamiliar with them?
Well no matter what control you use you'll probably want to handle printing seperate from it. I would still use the datagrid but here is code for a listview.
VB Code:
'you'll need to add a listview control to the form where you put this code
'setup listview
'this part can also be done at designtime in the IDE
"Is there a way to list the data like in detail view but without the column headers?"
Yes you can set the HeaderStyle to None.
"Or can I change the backcolor of them?"
Not that I know of but see above.
"What do you mean I could do this at design time with IDE? it's the IDE I'm asking about?"
Instead of through code you can do the setup part by changing the properties of the listview at designtime.
"Is there a way with the listview to make it so if you add more items than the size of the listview it will autosize or something like that?"
No there is not automatic resize you'll have to write your own. You can change the size but it doesn't autosize.
"And lastly....what would be the benifit of using a datagrid instead of the listview?"
Lots, mainly instead of filling each row and having each item be string representives of your data you can just bind the grid to the data itself and set formatting rules. If you aren't using some sort of datasource currently then you probably should or at least be using some class object (which can also be bound to the grid). The datagrid is just much more flexible in my opinion. You should learn more about it, it'll come in handy someday.
you know how with a datagrid on the very left hand side...it has like a column index or something ( an xtra colum for clicking or something....the very left one anyway..)
can you make that so it is not displayed?
cause if you can...then I think I'm going to try the datagrid instead. I was just looking at it.
I've used it before....actually in my current program I have about 5 different datagrids already.
I took your advice and used the datagrid..It's going to work out quite nice I think.....But how can I make it so it inserts all the items in the grid back to the database??
This is the main issue...I'm also going to post this big problem I'm having and c if you can help me with it too?
Thanks..
****************************************************
SQL DB Design??
hey everyone...
I'm kind of stuck on what I need/should do to do what I need my program to do.
I have a table called CUSTOMERS--It contains all the Customers
I have a table called PARTS-- It contains all the Parts
I have a table called INVOICES-- It contains all the Invoices
None of the tables are linked.
I've attached some printscreens of part of my program layout...
FORM1 is the first form to load.....you click on the customer you want and then it opens FORM2.
When FORM2 loads it, selects all Invoices that = the specific customer.
You can then click the NEW INVOICE button, which opens FORM3.
The you can click the "Click Here to add new part..." label, and that opens FORM4.
Then you just click the part you want and it then adds the part to FORM3...which you can see what it looks like with FORM5.
So I have a couple concerns.....
1. If I was to delete a PART from the parts table....and 1 of my invoices contained that part...then when I went back to edit the invoice..the part would not display... I want to be able to click on one of the Invoices from FORM2, and then edit the invoice if needed?
2. I need to be able to calculate Backorders, if the there is no stock of that part. I also need to be able to calculate Amount depending on stock and the price of the part??