|
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.
|
|
|
|
|
Sounds like you need a union .
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Vikram A Punathambekar wrote: Sounds like you need a union.
AFAIK C# doesn't provide it.
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.
|
|
|
|
|
[bangs head against wall]
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Stored Procedure Code
ALTER PROCEDURE sp_IsValidLogon
@UserName varchar(16),
@Password varchar(16)
As
if exists(Select * From User_Table
Where UserName = @UserName
And
Password = @Password)
begin
return(1)
end
else
begin
INSERT INTO FailedLogons(UserName, Password)
values(@UserName, @Password)
return(0)
end
Go
How can i receive this return value in C#. Kindly, if any1 can give the code for it.
|
|
|
|
|
why are you not using output parameters in your stored procedure so that you cann access those values in c#
Gautham
|
|
|
|
|
I have wriiten the following code but not receiving the value, if u can kindly give me the code to receive the value from the ssotred procedure
SqlCommand("IsValidLogin",conn2);
cmd2.CommandType=CommandType.StoredProcedure;
cmd2.Parameters.Add(new SqlParameter("@userid",SqlDbType.NVarChar,50,"UserId"));
cmd2.Parameters.Add(new SqlParameter("@password",SqlDbType.NVarChar,50,"Password"));
cmd2.Parameters[0].Value=textBox1.Text;
cmd2.Parameters[1].Value=textBox2.Text;
i=cmd2.ExecuteNonQuery();
|
|
|
|
|
hi,
the code below is a modification of your code. it should work.
SqlCommand("IsValidLogin",conn2);
cmd2.CommandType=CommandType.StoredProcedure;
cmd2.Parameters.Add(new SqlParameter("@userid",SqlDbType.NVarChar,50,"UserId"));
cmd2.Parameters.Add(new SqlParameter("@password",SqlDbType.NVarChar,50,"Password"));
cmd2.Parameters[0].Value=textBox1.Text;
cmd2.Parameters[1].Value=textBox2.Text;
SqlParameter param = cmd.Parameters.Add("@retVal",SqlDbType.Int);<br />
param.Direction=ParameterDirection.Output;
i=cmd2.ExecuteNonQuery();
int retVal = cmd.Parameters["@retVal"].Value;
hope this helps
regards
|
|
|
|