|
What type is it that it needs to be released ? If it;'s a string, it's not going to exist anymore, the app that holds it will have closed. If it's got an external handle or something, you can call Dispose on it in your main forms Close event handler.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
do u mean to realease the variable when closing the program. if so there is no need cz they will be released automatically.
|
|
|
|
|
Let's say I need an application to print sales receipts to a dot-matrix printer for a grocery store.
I want to print each line every time an item is keyed into the system.
In this case, I tried using this code, but it sends formfeed after every Print() function call:
<br />
public void Print()<br />
{<br />
PrintDocument pd = new PrintDocument();<br />
PrintDialog pDialog = new PrintDialog();<br />
pDialog.Document = pd;<br />
pd.PrintPage += new PrintPageEventHandler(PrintSalesItem);<br />
if (pDialog.ShowDialog() == DialogResult.OK)<br />
{ pd.Print(); }<br />
}<br />
<br />
public void PrintSalesItem(object sender, PrintPageEventArgs e)<br />
{<br />
Graphics g = e.Graphics;<br />
Font myFont = new Font("Arial", 10);<br />
g.DrawString("SalesItem1", myFont, Brushes.Black, 5, i*5);<br />
g.DrawString("ItemInfo1", myFont, Brushes.Black, 5, i*10);<br />
myFont.Dispose();<br />
}<br />
I also tried using winspool.drv functions directly, but I don't think I can control the fonts and size using it.
Can anyone help/suggest a solution for this?
|
|
|
|
|
hi all,
how i can insert a coloumn in the datagridview that conatins a text boxes fields
Thanks alot
Hamody
|
|
|
|
|
use template columns
<template column="">
Gautham
|
|
|
|
|
HI gauthee.
|
|
|
|
|
|
download the ComponentOne FlexGrid ))
VirtualVoid.NET
|
|
|
|
|
DataGridViewTextBoxColumn MyColumn = new DataGridViewTextBoxColumn();
myDataGridView.Columns.Add(MyColumn);
Try that. Syntax is off the top of my head, so you may have to modify things slightly, but at runtime, that's the way to do it. In the designer, right click the DGV and select "add column"
|
|
|
|
|
Hi all,
I have to start with a 3d game soon. So could please suggest me how is C#.NET for creating 3D games. Because i have heard C++ is the best option to create 3D game but C# is much simple than C++ so i am planning to use C#.
But i am not sure if C# gives all the functionality like C++ or not. Because i dont want to have a situation like in the mid of my project thinking that i should have used C++.
So please guide me the right path.
C++ OR C# is fine ?
Thanks
|
|
|
|
|
|
Since DirectX9 .Net has full support over DirectX and form what i have been told execution speed is very close to C++.
If i started ever again creating a game I would surely chooce .Net for DirectX9.
|
|
|
|
|
On click of a button how can i have data from one table into another in same database?
Actually i m making a login form,it has checked the data from a table for login from login table.
Now,i want some data from login table send to another table when user logs in.
Thank you for the response.
Nekshan.
|
|
|
|
|
If the two databases are on the same server then it is quite easy
You can fully qualify table names if you need to
[server].[database].[owner].[table]
[owner] if it is dbo can be omitted.
[server] can be omitted if both items are on the same server.
INSERT INTO destination_database..login
SELECT * FROM source_database..login
If the tables are on different servers then it becomes more complicated as you have to link the servers together first.
|
|
|
|
|
|
What is going wrong ? Does your connection fail ? What error do you get ?
I assume this code is not involved in the login process ? I also assume you haven't really called your button 'button1' ???
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
yes it's coming. thank u
|
|
|
|
|
Nekshan,
r u trying to insert values directly thrugh a query or a stored procedure??
Gautham
|
|
|
|
|
i m inserting data via query.
|
|
|
|
|
y cant u just give insert........values(textbox1.text.tostring, textbox2.text.tostring) instead of all the parameters!!!!
Gautham
|
|
|
|
|
Because parameterised queries provide some protection against SQL injection attacks.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
gauthee wrote: y cant u just give insert........values(textbox1.text.tostring, textbox2.text.tostring) instead of all the parameters!!!!
That would introduce vulnerabilities into the application. You really MUST read SQL Injection Attacks and Tips on How to Prevent Them[^] before giving out any more advice like this.
Also, myTextBox.Text returns a string already. So there is zero need to append ToString() on that.
|
|
|
|
|
He's plainly using SQL directly, you can see it there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Other than the obvious security issue of storing a password in plain text I don't see anything wrong with this. What error are you getting?
|
|
|
|
|
*grin* I asked that, a half hour ago....
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|