There are so many things wrong there, that I can't ifgnore them and even try to sort out you problem.
1) Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead:
SqlCommand cmd = new SqlCommand("insert into Tmedicine values(@TID)", con);
cmd.Parameters.AddWithValue(Tid());
con.Open();
2) Do not use the VS default names. You may remember that
label7
contains information on the VAT being charged today, but how do you expect us to know that? Or you, in two weeks time? Use sensible names - it saves a lot of time in teh long run.
3) Never issue SQL commands which depend on a nominal order for columns in a database. Always name the comulms and the order in which you will provide content: that way the database can be changed outside you controil without making your whole application fail for no obvious reasons, or worse corrupting your entire DB:
INSERT INTO myTable (column1, column2) VALUES (@Value1, @Value2)
4) Comment your code. Do we have any idea what a type of "IPD" means? No. So tell us. It helps you when you have to come back to it.
5) When you use CreateGraphics, you are responsible for Disposing it. If you don't all sorts of strange errors can creep in!
6) When you tell us there is a problem, "Generic error in GDI+" for example, tell us which line the problem is occurring on!
7) What does that code have to do with PrintDocument? Where is it being called? Why it is being called?