|
You're welcome. Glad to be of help.
|
|
|
|
|
Hi,
I have to print receipts on Thermal Printer. I found a example on net on http://www.taylorsnet.co.uk/Forums/ForumPosts.aspx?Subject=7[^]
But am wondering about the 1st parameter 'A = Text and H-Location (A for text, B for Barcode)
fileWriter.Write("A800, 20, 1, 3, 2, 2, N") ' 1st line
..........
fileWriter.Write("A750, 20, 1, 3, 2, 2, N") ' 2nd line
.........
A for Text is fine. but the H-Location is Y axis right - I assume as (B)V-location is same in both the line; so that should be X-axis.
If H-location is y, axis then why it is decreasing i.e from 800, 750 ..
Can anyone help me with this part. Is their anyway I can see the contents without printing - like saving the outFile or seeing in PrintPreview, etc.
Any help or guidance is highly appreciated.
Thanks & Regards,
|
|
|
|
|
You're using what looks like a File writer already. Just change whatever is being open to a file instead of whatever you're opening for the printer. Then you can send everything to a file instead of the printer.
|
|
|
|
|
Hi Dave,
By just changing to a file, it will give results like :
N
A800, 20, 1, 3, 2, 2, N"Name"
A750, 20, 1, 3, 2, 2, N"Address"
P1
I wanted a way to see the results like we see in Print Preview. Our print lines include g.drawString..., but the resuts are different. That's what I was asking for Thermal Printer. To know the code kindly refer the link provided in main msg from where I have taken.
Do you know anything about H-Location of this issue ?
Thanks & Regards,
|
|
|
|
|
The only way that's going to happen is if you write your own parser for the language the printer understands (implementing all the commands you have documentation for) and render the image in whatever window you want. There is no class in the .NET Framework that will do this for you. There is probably no 3rd party class that will do this either unless the printer you're using and the commands you send to it are one of the standard page description languages, like PostScript, PCL, ...
|
|
|
|
|
This code will only work if you're using a Zebra printer that understands these codes. It's not going to work for every thermal printer in existance.
Your best source of information on the code you send to the printer is the documentation on your printer, not someone elses code.
|
|
|
|
|
As much as i can remember you have a Zebra designer software comes with zebra printer driver CD. You can design your barcode using that software and also you can export that in a text format(ie the way you are printing).
also you have all documents (comes in a folder) how to print the barcode in that CD itself.
I think reading those documents will help you.
|
|
|
|
|
Hi,
In my desktop app developed in VB.NET, I want to send an email.
Private Sub CreateMessage()
Dim from As New MailAddress(fromTxt.Text.Trim, nameTxt.Text.Trim)
Dim toAdd As New MailAddress(toTxt.Text, totitle)
Dim msg As New MailMessage(from, toAdd)
msg.Subject = subjectTxt.Text.Trim
msg.Body = messageTxt.Text.Trim
Dim cc1 As New MailAddress(cc1.Text)
Dim cc2 As New MailAddress(cc2.Text)
msg.CC.Add(cc1)
msg.CC.Add(cc2)
Dim client As New SmtpClient()
Try
client.Send(msg)
ToolStripStatusLabel1.Text = "Message Sent Successfully"
Catch ex As Exception
ToolStripStatusLabel1.Text = "Error Sending Mail"
MessageBox.Show("Error sending mail : " & ex.ToString, "ERROR :: Try Again", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
cc1 = Nothing
cc2 = Nothing
from = Nothing
toAdd = Nothing
msg = Nothing
client = Nothing
End Try
Return
End Sub
Above is the code I use to send email. I have imported System.Net.Mail & set MailMessage object properly also created SmtpClient. But I don't know what and how to set the Smtp host. I mean, the app will be on differnet PC's & all will be using different means of Internet access. Then how can I know and set the host before sending message. I tried adding "localhost" but that didn't worked. What to do and how to achieve the goal ?
This should be possible and in a simpler manner - when I can do the same in my Java apps then why not in .NET apps. Searched a lot on net also, but every example showed "<your server="" name="">", but how can I know the server name of each PC ???
Any help guidance is highly appreciated.
Thanks & Regards,
|
|
|
|
|
|
Oh Thanks Dave for this.
Just wanted to confirm a point and make myself understand properly.
So a mail will have From & To. From will be someone who is writing & To will be my mail address (I will receive it). If my mail address i.e. To is of hotmail, then I got to implement of Live Mail, if of Yahoo then of Yahoo & if of gmail then of gmail. Then regardless of what the From address belong. If To is "...@hotmail.com" & From is "...@xyz.com" ; If I implement of Live Mail, then I will receive all mails send from anyone.
Am I correct or wrong at any angle. Kindly let me know.
Thanks & Regards,
|
|
|
|
|
From Address is the person sending, To address is the receiver, in this case you.
The SMTP server needs to be any server for which the user who is sending the email is authorised to use. It doesn't matter who the target (TO) address is, it is dependant on who the sender is.
SMTP servers generally need to be authorised, as there are very few open relays now due to the abundance of spam and abuse they receive.
|
|
|
|
|
Thanks Dave, I found my way and also solved the confussion.
But am just wondering 1 thing. In my form I already have ToolStripProgressBar. When the Send(mail) is being executed, for a short while I see 2 progress bars. Then 1 disappears. Can't find what is going on. Does Send() shows a progress bar by default - didn't find any such info in MSDN.
Can you tell what must be the reason of seeing 2 progress bar for a short while when Smtp.Send(mailMessage) function is being executed.
In MSDN I also found that when send is eecutes, it blocks so its safe to set timeout. Can you tell what value should be set in timeout - 100000 (100 secs) is good enough or should be more !
Thanks a lot.
Thanks & Regards,
|
|
|
|
|
Thats good to here.
your welcome.
|
|
|
|
|
When I run my application I am initializing some boolean flags - all of them are set to false at the begining, then just before the Load function ends - I am enabling another windows form full of buttons which are meant to be changing the flag statuses depending on which button the user presses. So when user presses the button on the second form - it run the function which is supossed to change flag status on the first form and after that it closses second form.
The thing is, that the flag status is not being changed, so if I want to set this flag status to true, it's all the time false. I don't know why. Below is the example code:
// declaration of values
private bool isFirstActive;
private bool isSecondActive;
private bool isThirdActive;
//splash screen form
private SplashScreen splashScreen;
//second menu form
private SecondMenu secondForm;
// initialization in constructor
public MainForm()
{
//show the splash screen to the user while loading
splashScreen = new SplashScreen();
splashScreen.Owner = this;
splashScreen.Show();
Application.DoEvents();
this.Enabled = false;
InitializeComponent();
isFirstActive = false;
isSecondActive = false;
isThirdActive = false;
}
private void MainForm_Load(object sender, EventArgs e)
{
//enable the main form
this.Enabled = true;
this.Visible = true;
//close the splash screen
splashScreen.Close();
//enable the second form
secondForm = new FacultyMenu();
secondForm.Owner = this;
secondForm.ShowDialog();
}
So now the user will see second form with some buttons, below the code for the second form with example button click:
private MainForm firstForm;
public SecondMenu()
{
firstForm = new MainForm();
InitializeComponent();
}
private void btnChangeSecond_Click(object sender, EventArgs e)
{
firstForm.changeSecondFlag();
Close();
}
So when user press the button, it will call the following method on the first form:
public void changeSecond()
{
isFirstActive = false;
isSecondActive = true;
isThirdActive = false;
}
Then it's closing the second form and goes back to the main form. but the isSecondActive valuse is still false.
Why?
|
|
|
|
|
acont wrote: So when user press the button, it will call the following method on the first form:
No, it will call a method on an object that has the class-type as defined for the class "MainForm". There's two of those objects; one that's your actual mainform, and that you use to open the second form, and then there's a new object of the same type, created in the SecondMenu method.
acont wrote: Then it's closing the second form and goes back to the main form. but the isSecondActive valuse is still false.
It's closing the second form, and the mainform contained therein (in the private variable firstForm). Then it goes back to the original mainform. The boolean is set in the second instance, the original object isn't changed.
How about passing a reference to your mainform in the constructor of the second form? You could cache a reference to that instance, changing things on that would correctly change the original object.
I are Troll
|
|
|
|
|
forget about this forum to get any help; its useless
|
|
|
|
|
|
imak wrote: Its not a repost
Then add the extra information to your original question, do not delete it and start a new thread.
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote:
Then add the extra information to your original question, do not delete it and start a new thread.
just read the information provided to get that extra info
|
|
|
|
|
No your asking us to do your work for you.
D@nish gave you a perfectly valid answer: it is possible.
You can't expect people here to just write the code for you, we all donate our time for free here. If you want somebody else to write your program then go and hire yourself a programmer and pay him.
If you want our help you'll have to proof to us that you at the very least tried to do it yourself (so post you code and where your stuck or have an error).
|
|
|
|
|
imak wrote: Is it doable via refelction?
Yes it is. But it will be quite bad considering application performance.
imak wrote: If so can you please post some example code?
Well, you should try yourself first and then ask with specific details. That is what the guidelines say.
|
|
|
|
|
Hello Friends,
I have developed a desktop software with VB.NET. I want to create some security measurements through which, after purchasing one copy, customer cannot copy to several computers or distribute freely. Their may be customers who may need the product to be run on N number of machines independently (not on Network). In that case also, the customerId may be same but each machine must have independent copy of the product.
How can I achieve such security measurements for newly developed desktop software?
Any helpline, guidance is highly appreciated.
Thanks & Regards,
modified on Friday, September 3, 2010 9:16 AM
|
|
|
|
|
I can think of two ways of doing it.
1. Have a product key and validate it on your server. You can keep the IP and the key to be sure your software has been installed. This will require the users to have internet connection at least while installation.
2. I am not sure how this can be done, but here's the thought. If you can get the details of the computer where your application is installed in the setup some how while installation, next time when the same setup is used, it can prompt that the S/W has already been installed on another computer.
|
|
|
|
|
d@nish wrote: 1. Have a product key and validate it on your server. You can keep the IP and the key to be sure your software has been installed. This will require the users to have internet connection at least while installation.
Can you tell how does this product key option works. I feel the logic & flow should be such as :
1 User is installing
2 While installation it talks to a other app lying on the Server.
3 The server app, keeps the IP address, checks in another DB lying at server.
4 If the IP address is new, provides a Product key and stores the same against the IP on the DB located at Server.
5 If IP address is not new, displays appropriate message and doesn't allow to install the app.
Can you confirm with the above logic. And also if possible provide any code for me as help to proceed.
REG 2nd Point - what kind of computer details can be retrieved and checked out. Any clue.
Thanks & Regards,
|
|
|
|
|
For the first approach, you can use following logic:
1. Provide a key along with the setup. When the user enters that, pick up the IP address* and send them both to server.
2. Server should then check in the DB that the sent product key is already registered with some other IP*.
3. If yes, and IP* is same, let the user install and if IP* is different, deny installation.
*Many people have dynamic IPs and hence this logic looks flawed. You can get the Mac address since it is a unique number for each computer. Although, if the end user has tried Mac spoofing ie changing Mac address, there might be some problems. Still this IMHO will be a bit more secure way.
For approach two, Mac address can be a number you can track.
Since I have never implemented anything like this I cannot provide code sample right away. Although googling something like "product registration" might give useful results.
|
|
|
|
|