|
hi,
i like to build a restaurant billing system. i would be using Visual Studio 2019. language would be C#.
my question is regarding printing bills.
what is the easiest 3rd party software I can use with Visual Studio 2019 for printing bills to a thermal printer.
|
|
|
|
|
If you are using Windows, the issue is whether your thermal printer has a driver for Windows. If it does, you print to it like you would print to any other Windows printer.
Note that your code will still have to take certain details into account, such as the narrow width of a page, the length of the "page" (a POS printer typically uses a roll that is of "infinite" length). Any such details should be available in the technical reference manuals of the POS printer(s) that you intend to support, or on the manufacturers' websites.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Oops! I missed the button ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Just to add to what Daniel has said, start with the manufacturers site or tech support - most will have sample code that should give you a "starter".
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi,
I'm trying to use Devexpress library in my own project. I use PivotGridControl to load an excel data into PivotTable. For a test, I used the following code:
public Form1()
{
ExcelDataSource myExcelSource = new ExcelDataSource();
myExcelSource.FileName = @"C:\Users\Fardin\Desktop\Book1.xlsx";
ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("Sheet1", "A1:B20");
myExcelSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);
myExcelSource.SourceOptions.SkipEmptyRows = false;
myExcelSource.SourceOptions.UseFirstRowAsHeader = true;
myExcelSource.Fill();
pivotGridControl1.DataSource = myExcelSource;
}
But there is following error in
System.NullReferenceException: 'Object reference not set to an instance of an object.'
I upload the whole project package:
https://www.dropbox.com/s/vmokcgu21jqohpo/DXApplication1.rar?dl=0
And for Excel file:
Dropbox - Book1.xlsx - Simplify your life[^]
Please guide me.
modified 22-Jan-21 5:08am.
|
|
|
|
|
[Devexpress Forums]=>
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Impossible to answer properly, since you didn't even tell us which line / variable is null .
At a guess, the pivotGridControl1 is initialized in the compiler-generated InitializeComponent method, which you haven't called. Therefore, the field is null , and you get a NullReferenceException on the pivotGridControl1.DataSource = myExcelSource; line.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Just to add to what Richard has said...
When you create a form, all the "heavy lifting" of creating controls, setting form properties, and suchlike is performed for you in the MyFile.Designer.cs file method InitializeComponent , which is why the default Form file always contains a constructor which calls it as the first line of code.
This file is created and maintained by the VS designer and isn't normally edited directly.
If you don't call InitializeComponent when you edit the Form constructor, then no controls or properties are ever created for you, and the variables allocated by the designed for them will remain empty - they will contain the default value for a reference value: null
So when your code tries to use them for anything at all, you will get a null reference error, as you have seen.
To be honest, you should have spotted that yourself, and thirty seconds with the debugger would have put you on the right track pretty much immediately! It's worth getting used to the debugger, it's your best friend and will save you hours of hair pulling frustration!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks. I saw in debugger that says "
pivotGridControl1 was null. but I didn't know what was wrong with it.
Now, I can run the component but my Excel data isn't listed in the PivotGridControl and still says drop filter items.
|
|
|
|
|
I solved it:
pivotGridControl1.RetrieveFields();
|
|
|
|
|
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
i wanna ask, anybody can give suggestions of references for tutorial for C# windows application using Visual Studio 2019? any references like e-books, web sites, etc
|
|
|
|
|
The best way is a course: if you don't understand something, then the tutor can rephrase or explain until you do. They also require you to practice via homework, which means you learn better - we learn best by doing, not looking. Check locally for these.
The second best is a book: They are structured like a course is, and will "guide you through" the process introducing pretty much everything at sensible points and giving examples for you to code, helping the learning process. Addison Wesley, Wrox, and Microsoft Press all do excellent books that cover the subject well.
Websites are iffy - a lot of them have no idea how to teach, and even less how to learn. I'd avoid them as the very few good ones are hidden in a huge mas of dross.
The worst way is YouTube tutorials. There may be good ones out there, but I've never seen one, and all the ones I have seen have clearly known nothing about how to make a video, how to teach, how to learn, how to code and in some cases how to get the top of a bottle. Most of 'em are there purely for "Subscriptions" and the revenue stream that generates - few have any idea why code works when it does.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
can you give suggestions for which courses that you mean? did you mean online or offline courses?
also, can you suggest couple of best book titles for this?
|
|
|
|
|
|
actually, i'm reading "The C# Programming Language - Fourth Edition" by Andres Hejlsberg, Mads Torgersen, etc
but, i'll try to look to your suggestions
thx
|
|
|
|
|
Well that is a bit more advanced, but an excellent reference. It was not clear from your question what actual level you are at.
|
|
|
|
|
i actually learned some basics on C++ and seems like it doesn't really different with C#, so i wanna learn windows programming in both languages
|
|
|
|
|
No they are very different. Try learning both together and you will get very confused. Stick with C#, it is much more intuitive.
|
|
|
|
|
but wasn't C++ is used for many big applications? for me, i like them both... also java and C-like langs...
|
|
|
|
|
Yes, but that has nothing to do with your question.
|
|
|
|
|
|
|
|
i google-ed before i ask here but seems like it doesn't much tutorials for this
|
|
|
|