|
Hello
fileDialog.Filter="*Text File (*.txt)|*.txt";
All the best,
Martin
|
|
|
|
|
Remove | from filter...
Here is the new code
string content = "Whatever... :)";<br />
SaveFileDialog fileDialog = new SaveFileDialog();<br />
fileDialog.Filter = "Text File|*.txt";<br />
<br />
if (fileDialog.ShowDialog() == DialogResult.OK)<br />
{<br />
TextWriter writer = new StreamWriter(fileDialog.FileName);<br />
writer.Write(content);<br />
writer.Close();<br />
}
|
|
|
|
|
Hello,
I found out that my ApplicationContext instance holds a reference of my Splash window (Windows.Forms.Form), so that GC can not free the memory. (MemProfiler[^]told me)
It's not a real problem for my program, but I'm curious why.
My program is working like his:
1) At startup my splash form is instanciated.
2) An ApplicationContext instance is created, with my splash instance as parameter:
AppContext = new ApplicationContext(_splash);
Application.Run(AppContext);
3) Startup continious (instanciates classes like mainwindow and so on) and feeds splash with information to show.
4) Startup finished
5) Now my mainwindow is linked to the ApplicationContext and replaces the splash form.
AppContext.MainForm = _mainwindow;
_mainwindow.Show();
6) Splash is closed and local references which are linked to the splash class got disposed.
_splash.Close();
_splash = null;
.
.
It looks to me that in "5)" I'm doing something unsufficiant, so that AppContext still holds the ref to the splash.
I'm open for all suggestions.
Thanks for your time.
All the best,
MArtin
-- modified at 5:38 Wednesday 13th June, 2007
The ApplicationContext holds the reference to the Splash form over the Application.ThreadContext.RunMessageLoopInner method, where the instance is passed as an argument.
|
|
|
|
|
Hi Martin,
I have no experience wirth ApplicationContext; I once did a splash screen without it.
But I just read an article[^] on it, it may interest you.
Now I discovered same article here ![^]
Regards,
|
|
|
|
|
Hello Luc,
Thanks for the links.
I will go threw them and let you know if it helped.
All the best,
Martin
|
|
|
|
|
Hello Luc,
Again, thanks for your time!
I downloaded the source of the article you provided, and found out that there is exactly the same happening as in my project.
Apart from that the article shows very well how a inherited ApplicationContext class can be modified for the Splash usage.
So thanks for the link!
I also posted the question in the article, maybe the autor is interested in that fact.
All the best,
Martin
|
|
|
|
|
I have a XML file. I want to open that XML file in browser, when i click on the button.
Help me out.....
|
|
|
|
|
FileStream fileStream = new FileStream("c:\\dat.xml", FileMode.OpenOrCreate, FileAccess.Read);<br />
<br />
long len;<br />
<br />
len = fileStream.Length;<br />
<br />
Byte[] fileAsByte = new Byte[len];<br />
<br />
fileStream.Read(fileAsByte, 0, fileAsByte.Length);<br />
<br />
<br />
Response.Clear();<br />
Response.ClearContent();<br />
Response.ClearHeaders();<br />
<br />
Response.Buffer = true;<br />
Response.ContentType = "text/xml";<br />
Response.BinaryWrite(fileAsByte);<br />
Response.Flush();<br />
Response.End();
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Which button? A button on the form? If yes then add an event handler for the button and use Process class to open browser and pass the xml file as a parameter.
|
|
|
|
|
Not sure why you'd want to open the file in a specific application but the best way to open a file using the associated program is
System.Diagnostics.Process.Start("PathToYourFile");
If you really, REALLY know what you are doing and want to open it in a specific application, it will most likely support command line arguments.
System.Diagnostics.Process.Start("ApplicationPath", "PathToYourFile");
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
I need to develop one desktop application on C#. Where I have to integrate Microsoft Outlook with the application. User want to send a file or a zipped folder to an e-mail ID. User want that once he select recipient from the drop down menu of the application. All files related to that corresponding recipient, stored in a particular folder should be sent to recipient automatically, with some message. There should be folders in the local drive of the user, for each and every corresponding recipient. User wants the facility to send the files to multiple e-mail IDs (e.g. Outlook ID, Yahoo ID, Google ID) of selected recipient. List of recipient, path of corresponding folder and their corresponding multiple e-mail IDs are going to be hard-coded.
|
|
|
|
|
you should look at the system.net.mail namespace it will pretty much do what you are after. If you look up on MSDN there are a tonne of examples.
http://msdn2.microsoft.com/en-us/library/system.net.mail.aspx
That should be a good start, otherwise google is your friend.
-- modified at 5:00 Wednesday 13th June, 2007
edit: didnt realise you wanted to do it through Outlook. Then you got use the Outlook object model, the outlook interop dll, thats pretty easy. If you have access to the book Visual Studio Tools for Office, it provides some sample code.
try
http://msdn2.microsoft.com/en-us/library/ms268893(VS.80).aspx
|
|
|
|
|
how to show ballon tooltip on cell of datagrid
|
|
|
|
|
Place DataGridView on form, add some columns and rows and add event handler for CellMouseEnter. Add following code into event handler:
private void dataGridView1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if ((e.ColumnIndex >= 0) && (e.RowIndex >= 0))
dataGridView1[e.ColumnIndex, e.RowIndex].ToolTipText = e.ColumnIndex.ToString() + ":" + e.RowIndex.ToString();
}
|
|
|
|
|
Hi,,
I have created deployment setup for my project by using VS Depolyment project Wizard, i want to have uninstallation option as part of that, how can i add it ?
Thanks in advance ...
|
|
|
|
|
I'm trying to create a subclass of Slider which slide from one color to the next and has a gradient brush background.
The C# code has 2 new properties: StartColor, EndColor
The XAML code is the following:
==================
<Slider x:Class="TransparencySlider.ColorSlider"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="root">
<Slider.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="{Binding StartColor, ElementName=root}" Offset="0.0"/>
<GradientStop Color="{Binding EndColor, ElementName=root}" Offset="1.0" />
</LinearGradientBrush>
</Slider.Background>
</Slider>
==================
however at runtime the gradient brush is all white and the log message (in the output windows) is: "cannot find source element for the binding", i.e. cannot find 'root', this slider, the control itself.
mmhh... why is that?
what should I write?
I'm running into a wall......
|
|
|
|
|
I am creating a website through code.
I want to set its framework version to 2.0 by default.
Any idea how to do it?
Please F1.
Nana
|
|
|
|
|
Open Internet Information Services
Right Click on the particular Virtual directory
Select Properties
Select ASP.NET tab
There you can find ASP.NET Version in a list. Select your version and apply it.
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Hi,
i have a problem concerning float values.
I receive a 4 Byte value through the serial port in the following order:
SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM
S - Sign
E - Exponent
M - Mantissa
so, for example i have:
43h 89h 80h 00h (h...hexadecimal)
which is the decimal value of: 275.0
My question is, if anybody knows a way of converting the 4 Byte value to the float value.
Thanks in advance for any help you can provide
|
|
|
|
|
In C++, you would write
number = (sign ? -1:1) * 2^(exponent) * 1.(mantissa bits)
|
|
|
|
|
Actually, with C++ you can be more extreme, for instance:
unsigned char myBytes[4]={0x43, 0x89, 0x80, 0x00};
unsigned char myReversedBytes[4];
myReversedBytes[0] = myBytes[3];
myReversedBytes[1] = myBytes[2];
myReversedBytes[2] = myBytes[1];
myReversedBytes[3] = myBytes[0];
float f = *(float *)myReversedBytes;
Note that if you're lucky the original bytes have not to be reversed.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Use the BitConverter.ToSingle method.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks a lot.
This really helped me. I almost thought i would have to code it on my own.
|
|
|
|
|
Note that, If you intend to use the Guffa solution (that indeed is the correct one), then you have to reverse the order of the bytes to get the correct result.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks,
you guys are a real good source for advice.
No wonder that there are lots of people asking anyone of you instead of looking in the msdn documents.
|
|
|
|