|
Hi
It's possible
If you want to have some global variables that you can access from all of your forms you can implement them as static variables.
If you want to pass some info from some form to another here is my suggestion:
Have a constructor that accepts the variables as its arguments or you can have some properties for your form and pass the variables using them.Here's a better way that I suggest .Implement a context object that has the variables that you'd like to pass in it.then you can pass the context object between you form using one of the ways I mentioned.
|
|
|
|
|
|
Hi All,
I am using print preview control on a windows form and use a print document to print. I check for the installed printers in the network and by selecting the printer, i set the printername and print the document. Bu this works fine if the printer is installed in the same system where the application is installed. When the printer is on another system i get a blank page after printing. I dont know how the print document become empty at this time.
Please advice.
Thanks in advance for your help.
Ali
|
|
|
|
|
Hi friends ...
I m facing problem in writing contents of BLOB field from database
to wordfile(.doc).
I used BinaryWriter for writing to the file. it works fine but when I
open the file in append mode and try to append the contents it do not works.
any sample code
thanking you ...
|
|
|
|
|
I'm afraid that appending information to a word document is not that easy to just open the file and append the contents to it.I think that you should use MS Word COM dlls to do such things.Using an Interop to MS Word dll you can almost do anything that you can do with word to a Doc file.For example you can save your information as a file and then insert it to the word document.
There most be a lot of articles about working MS Word using C# on the Net.
|
|
|
|
|
I'm using Npgsql to connect to postgresql in my dot net app. I create a new connection every time I need to perform a database operation. I store the username and password and if the user goes to another windows form, I pass the username and password to the constructor and then create another connection. This seems wrong to me. Is there a better way to do this?
|
|
|
|
|
I think so; instantiate the connection once, open it and close it as needed, pass it around as needed.
|
|
|
|
|
Hi
Here's my suggestion
Have a DataHelper(or DataManager) class that is responsible to do DB management and other stuffs (like opening connections) make it singleton.
It can have a OpenConnection method that opens a new connection and returns it every time you want an open connection.For example
using(SqlDBConnection cnn=DataManager.Instance.OpenConnection())<br />
{<br />
cnn.Close()<br />
}
Hamidian
|
|
|
|
|
Oh I forgot that you were not using SQL Server.Then replace the SqlDbConnection with OleDbConnection.
|
|
|
|
|
It doesn't seem to bad to me. This is (in effect) the way that you would be working with the connections if you were working in a technology like ASP.NET. If the connection is pulled from the Connection Pool then you shouldn't have too many problems.
|
|
|
|
|
I'm using visual C# 2005 to develop software, and I was wondering if certain drag commands could be used to drag a picture box from one window to another and the picture in the picture box onto the other window.
If you need it describing in more detail, then I will.
If this is possible, could someone tell me how to do it?
|
|
|
|
|
Hi there,
I've written a c# application that uses Access 2003 as the backend database. Does anyone know of any potential complications I should be aware of if the the databasse is upgraded to Access 2007? I personally don't think there should be any issues, but wanted to poll the audience to see if anyone's tried it and ran into problems. Thanks!
~~~~~~~~~~~~
Over-worked, under-paid, glorified "secretary"
|
|
|
|
|
Don't think there is going to be any issues. Have done so without any problems.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thanks!
~~~~~~~~~~~~
Over-worked, under-paid, glorified "secretary"
|
|
|
|
|
No problem. Only thing that does come to mind, is that I've seen connection strings be a bit different for 2007. But, it shouldn't be something to break your app.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Anyone here knows how to save spoken voice from msagent characters as an output to a wave file??
Thank you guys
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
And this has what to do with C#??
|
|
|
|
|
Dave Kreskowiak wrote: And this has what to do with C#??
Dave Kreskowiak wrote: A guide to posting questions on CodeProject[^]
Ok, it's an ActiveX control but come on, it can be implemented in C# and I just wanted to know if there's any way round someone could do it
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Then you should have been more specific. For all we know, you were trying to record stuff from Messenger in an IM session.
No, AFAIK, there isn't a way to do it directly. You'd have to write your app to record the sound just like you were recording from a microphone.
|
|
|
|
|
Dave Kreskowiak wrote: Messenger in an IM session.
Did I sound like I was trying this sh*t
Sorry , thanks for the tip Dave, I thought so as well but also thought to dig it around in the cp before giving up to recording.. Thanks again Dave
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I'm trying to fill in a text box then hit the submit button using httpwebrequest.
Here is a sample using googles home page(just because everyone can use it). I just cant seem to get it to work. Thanks for the help.
string Uri = "http://www.google.com";
string requestString = "q=test&btnG=Clicked";
byte[] requestData = Encoding.UTF8.GetBytes(requestString);
HttpWebRequest request = null;
Stream stream = null;
HttpWebResponse response = null;
// set up request
CookieContainer _cookies = new CookieContainer();
request = (HttpWebRequest)WebRequest.Create(Uri);
request.Proxy = null;
request.CookieContainer = _cookies;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = requestData.Length;
// make form post
stream = request.GetRequestStream();
stream.Write(requestData, 0, requestData.Length);
// get response
response = (HttpWebResponse)request.GetResponse();
|
|
|
|
|
Where exactly do you get the error?
------------------------------------------------------------
"The only true wisdom is in knowing you know nothing." --Socrates
|
|
|
|
|
Hi guys,
Need help please, is it possible to have a drop down list or combo box in a C# datagrid with .NET 1.1? Please advice on how to go about it.
Thank you
Sameer
|
|
|
|
|
No, there is no built in way to do it. What you can do, however, is this: You can get the location of the cell where you would like the combobox, or whatever. You have the location, then dynamically create the control, and set the location to inside the cell that you want it to be in. Then, handle the scroll event of the datagrid, and then get the location of the cell again, and then move the control that you created.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thank you for your quick response Justin, do you have an example on how to do this?
Thanks
Sameer
|
|
|
|