|
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
|
|
|
|
|
Its pretty easy, you can just use the ItemTemplate property. Here's an example:
<columns>
<asp:templatecolumn>
<itemtemplate>
<asp:dropdownlist id="ddl" width="150" runat="server"></asp:dropdownlist>
</itemtemplate>
</asp:templatecolumn>
</columns>
To access in code behind, you can use the FindControl method on a datagrid row or cell.
<div class="ForumMod">modified on Wednesday, January 02, 2008 9:04:48 AM</div>
|
|
|
|
|
I have a small program to monitor a sensor, detect an error state (sensor value goes over a setpoint), then change focus to a running application and send the {END} key to stop acquisition (before bad things happen!). I am using this code which seems to work fine...:
<br />
methodcall....<br />
{<br />
Process pr = new Process();<br />
pr = Process.GetProcessesByName("PeakSimple329")[0];<br />
IntPtr psHandle = pr.MainWindowHandle;<br />
<br />
if (psHandle == IntPtr.Zero)<br />
{<br />
MessageBox.Show("Peak Simple is not running.");<br />
return;<br />
}<br />
<br />
SetForegroundWindow(psHandle);<br />
SendKeys.SendWait("{END}");<br />
SendKeys.Flush();</end>
}
<br />
<br />
[DllImport("USER32.DLL")]<br />
public static extern bool SetForegroundWindow(IntPtr hWnd);<br />
This works perfectly "the first time." So if I reset the my C# application (to start monitoring again) and restart a run on the PeakSimple program, when triggered, the method call will set focus to PeakSimple, but won't send the {END} key anymore? If I shut down my C# app, then re-run it, the method call will work???? I added the SendKeys.Flush() command, thinking perhaps it would "clean up" any reference to previous key sends, but it doesn't help. I tried to Invalidate() the form, again to no avail.... I can't figure what "state" needs to be flushed, reset or invalidated to make the SendKeys.X command work a second time within a running C# app? I tried just doing a SendKeys.Send("{END}") instead of the SendWait which works, but also only the first time (I have to restart the app to get it to work "again"). If I set breakpoints, it goes through the code and performs the SendKeys.SendWiat or .Send method, but it doesn't actually "send" the key-stroke on subsequent calls to the method??? I must be missing something, but I can't find anything in my searching that explains this behavior??? Any help appreciated...
Thanks!
|
|
|
|
|
Hi, I have 1 TextBox with the follwing properties:
<br />
tbx1.Size = new System.Drawing.Size(155, 28);<br />
tbx1.MultiLine = true;<br />
and an other one like this
<br />
tbx2.Size = new System.Drawing.Size(155, 14);<br />
tbx2.MultiLine = false;<br />
Why, on the screen, tbx1 has an indentation of one space? I don't like to see the texts not aligned. Does some body have any idea?
Happy new year to everybody!!!
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
Are you sure that tbx1 doesn't have a space in the text field of the Properties window?
"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")
|
|
|
|