|
What code are you using? I suspect that you didn't call the Close() method right after you created the file. We can't do much without seeing the actual code you use. But anyways, here's a sample code I use when creating/writing text files:
FileStream <code>fs</code> = null;
string <code>tmpFile</code> = "C:\\sample.txt";
<code>fs</code> = File.Create(<code>tmpFile</code>, 1024);
<code>fs.Close();</code>
TextWriter <code>wr</code> = new StreamWriter(<code>tmpFile</code>);
<code>wr.WriteLine("Stuff 1");
wr.WriteLine("Stuff 2");
wr.WriteLine("Blah blah blah......");</code>
<code>wr.Close();</code>
Regards,
Polis
Can you practice what you teach?
-- modified at 9:53 Thursday 15th December, 2005
|
|
|
|
|
I want to provide operators of my C# software the opportunity to change screen resolution to optimal settings (1024x768) for viewing this particular software. How do I change screen resolution (and maintain those changed settings), should the user opt to do so?
-- modified at 11:08 Tuesday 20th December, 2005
I should have added the following. The computer that will be running the program is, in this case, a dedicated machine. It's purpose is basically to run the software I'm developing. As such, it makes a certain sense to have the display settings optimal for the particular application-should the operator opt to set them that way. The operator is under no obligation to set the computer to those optimal settings and will have the option to not see the message box again after the initial run of the program.
|
|
|
|
|
You can do this by using P/Invoke to access the Win32 API from your C# code. Have a look at the ChangeDisplaySettings function and the DEVMODE structure. You will need to create the DEVMODE structure in your code and use DllImport to call ChangeDisplaySettings. The following link documents the DEVMODE structure.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_8nle.asp[^]
I hope this helps.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
What you're doing is not recommended, and, in fact, actively discouraged. Changing system-wide settings affects other applications that are running and also affects the layout of the desktop. Remember, Windows is a shared system, running multiple applications at once. You have to make sure you app works and plays nice with others. Changing system-wide settings so your app looks good, can make another app running at the same time look bad.
I know if you did that to my machine while I'm working in Maya at 1900x1440, I'd be heading straight for Add/Remove Programs and dumping your app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote: I know if you did that to my machine while I'm working in Maya at 1900x1440, I'd be heading straight for Add/Remove Programs and dumping your app.
In general, agreed. THe only time forcing a resolution should be allowed is in full screen mode, and then be sure to restore the settings when the user closes or alt-tabs out of your program.
|
|
|
|
|
I want to initiate the sending of a fax from within a C# application. I want to specify the file I want to send and then launch the Send Fax Wizard allowing the user to type in the fax number, the To, etc... Does anyone know how to do this? I noticed that Send Fax Wizard does not allow for attaching files. I was able to send faxes bypassing the Send Fax Wizard all together, but that's not entirely what I need.
Many thanks.
tom d
|
|
|
|
|
here is one example
http://www.interfax.net/en/dev/c.html
|
|
|
|
|
Thanks, but that's not entirely what I need. I need to use the Send Fax windows client and prompt the user for fax number, location, etc, etc. Any ideas would be greately appreciated.
cobra2005
|
|
|
|
|
try this
http://www.codeproject.com/isapi/aspfax.asp
|
|
|
|
|
The link you've indicated has to do with sending a fax from a web page. All I want to do use COM-Object (faxcom.dll) to fax a PDF document. I want to "attach" the document to the object and fire up the Send Fax Wizard.
cobra2005
|
|
|
|
|
Hello everybody,
I want to change the cursors over all input controls (textboxes) on a form in a loop.
I tried something like:
foreach(TextBox tb in formclassname)
{
tb.Cursor = Cursors.No;
}
What's the right code to make the expected operation ?
Thank you in advance
Frank
-- modified at 11:45 Thursday 15th December, 2005
|
|
|
|
|
Assuming you are trying to change the cursors from within the form that the textboxes are on, you can try something like this:
foreach (Control tmp in this.Controls)
if (tmp is TextBox)
tmp.Cursor = Cursors.Hand;
Or like this:
foreach (Control tmp in this.Controls)
if (tmp.GetType().Name == "TextBox")
tmp.Cursor = Cursors.Hand;
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thank's
that's what I'm looking for.
Frank
|
|
|
|
|
I would like to use a NumericUpDown and add the unit (feet, ...) after the number.
This is made by extending the NumericUpDown class and overriding the UpdateEditText method like that:
protected override void UpdateEditText()
{
//Let the base component format the number according to the different properties
base.UpdateEditText();
//Add the unit
base.ChangingText = true;
base.Text = base.Text + " " + unit;
base.ChangingText = false;
}
But the problem is when a user change a part of the text in the textbox,
the ParseEditText method cannot parse a string like "2 feet",
and i cannot override this method like it is not virtual or abstract in the base class (Why did Microsoft do that?).
Please help me to find a solution.
Thanks in advance
|
|
|
|
|
Hello,
I have a task to write a tool that converts the structure of a sybase database to postgre database. What are the steps I need to follow to do such converter tool? Please help with ideas and examples if possible !
Thanks
|
|
|
|
|
in my extended datagridcolumn i press tab , cursor jumps 2 cells :S
I think i can solve this problem with using PreprocessKey message but i dont know how to write code, could anyone show a sample?
|
|
|
|
|
Hi friends,
Am transforming datas from one excel file to another using OleDbReader....
While this,the datas are transferred but the datatypes couldnt be...
How can i do it?
Am using OleDbReader to read the tableschema.....
Kindly Help.....
Thanx....
|
|
|
|
|
i am using com dll in my project which fires up event
code in vb is like this
Option Explicit
Dim WithEvents p As CLAMXLib.ClamEngine
Dim mresult As ClamResult
Private Sub p_OnScanComplete(ByVal result As CLAMXLib.IClamResult)
Set mresult = result
End Sub
in c#
CLAMXLib.ClamEngine p;
ClamResult mResult;
//now how will i catch events
code of class where i have to catch up event
public class clamresults
{
CLAMXLib.ClamEngine p;
ClamResult mResult;
public clamresults()
{
//
// TODO: Add constructor logic here
//
p=new ClamEngineClass();
p.Database.Path="E:\\projects backup\\ankitclam backup\\Clamtest\\database\\";
}
public string loadDatabase(string command,string dirpath)
{
if(command=="SCAN")
{
mResult=scanfile(dirpath);
}
else if(command=="RAWSCAN")
{
mResult=scanBuffer(dirpath);
}
else if(command=="CONTSCAN")
{
mResult=scandir(dirpath);
}
return mResult.Summary;
}
public ClamResult scandir(string dirpath)
{
p.Settings.ScanSupport=ClamSupport.Scan_Standard;
mResult= p.ScanDirectory(dirpath,0,ClamBoolType.False ,ClamBoolType.True);
return mResult;
}
public ClamResult scanfile(string dirpath)
{
p.Settings.ScanSupport=ClamSupport.Scan_Standard;
mResult=p.ScanFile(dirpath,ClamBoolType.True);
return mResult;
}
public ClamResult scanBuffer(string dirpath)
{
mResult=p.ScanBuffer(dirpath,ClamBoolType.False);
return mResult;
}
}
now how and where i will catch up events which will be generated from com dll
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
-- modified at 6:23 Thursday 15th December, 2005
|
|
|
|
|
We have a c# object being referred to by ASP.NET application.We want to implement an object pool for the C# component,with the number of intances being configurable.
Assuming that ASP.NET is servicing requests in 25 concurrent threads,we want the services to be processed by the instances from the pool.
Moreover ,the instances are initialized right at the beginning.How do we implement this object pooling?
We need this architecture as the c# object contains a handle to a COM component which has a very expensive initialization process.
A pointer to a reference article will be very helpful
|
|
|
|
|
|
Dear All,
Dear All,
I made a webservice, which takes more than 70 seconds to compute something. When I simply run the webservice it returns me the result. But when I access it through application(C# window), it raise TIMEOUT exception.
I also tried via increasing the timout value for sessionState element but not able to solve the problem.
With Regards
Manoj
|
|
|
|
|
Change the timeout for the object that handles the webservice call. It's the timeout for the web request, not the session timeout.
---
b { font-weight: normal; }
|
|
|
|
|
Dear Guffa,
I tried by increasing the
httpRuntime's executionTimeout to 1300, still its not working.
Thanks & Regards
Manoj
|
|
|
|
|
No, not the execution timeout, the web request timeout.
---
b { font-weight: normal; }
|
|
|
|
|
Dear Guffa,
Thanks you a lot for giving the solution. Actually your First reply given the solution, which I had not understood . Now I got what you were saying.
I am really sorry, i was not able to understand.
Thanks Thanks you a lot for the solution
Manoj
|
|
|
|