|
Sorry my mistake
I want to call a *.swf file... not an *.exe file.
Thanx for the reply.
|
|
|
|
|
-Bring the Toolbox Window, right-click and choose Customize Toolbox
-Select "Shockwave Flash Object" from the COM components tab. This will automagically build all interop libraries for the ActiveX control.
-Drop the control on your Form
-Depending on whether you want to dynamically set the .swf url or not :
-Static url : bring the Properties Window. On the top is a "Property pages" button. Set the url there. This will show the .swf movie at design-time.
-Dynamic url : once you have dropped the control, it creates a new member in your form, for instance axShockwaveFlash1. Just add this code : axShockwaveFlash1.Movie = "http://....swf";
|
|
|
|
|
Ok, so I've got this little C# app that updates my asp.net weblog. I plan on passing it on to other people I know, but then I came across a problem...
The files are outputted to the "entries" folder (name by the year, month, day, hour, minute, but thats irrelivant...) located on my hard drive in... (the location is in bold below). So, my problem was that, what if they wanted to change the location of the entries folder... you know... export the files somewhere else on the hard drive.
string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";<br />
XmlTextWriter writer = new XmlTextWriter("<big>C:/inetpub/wwwroot/weblog/entries</big>/"+ fileName, null);
SO, then I put togeather a little options form (options.cs) with a text box to enter the location on the drive, and then you click 'OK' and then it is saved to "options.xml". (see the code below...)
private void buttonOK_Click(object sender, System.EventArgs e)<br />
{<br />
XmlTextWriter writer=new XmlTextWriter("options.xml", null);<br />
writer.Formatting=Formatting.Indented;<br />
writer.WriteStartDocument();<br />
writer.WriteStartElement("Options");<br />
{<br />
string entryFile=textBoxEntryFile.Text;<br />
writer.WriteStartElement("entryFile");<br />
writer.WriteString(entryFile);<br />
writer.WriteEndElement();<br />
}<br />
writer.WriteEndElement();<br />
writer.WriteEndDocument();<br />
writer.Close();<br />
Form.ActiveForm.Close();<br />
<br />
}
This is what the options.xml file looks like....
?xml version="1.0"?><br />
<Options><br />
<entryFile>C:\inetpub\wwwroot\weblog\entrys\</entryFile><br />
</Options>
Now, I need this...
XmlTextWriter writer = new XmlTextWriter("<big>C:/inetpub/wwwroot/weblog/entries</big>/"+ fileName, null);
...instead of saveing it evertime.... unconfigurable.... to "C:/inetpub/wwwroot/weblog/entries", but rather save the entries to what ever file it says in the "options.xml" file.
WHEW!... i hope that made sense... im not familar with the XmlTextReader (assuming that what is to be used...) stuff... thanks for all the help possible.
/\ |_ E X E GG
|
|
|
|
|
Although it's not using the XmlTextReader, this should do what you want.
<br />
FileStream strmSettings;<br />
XmlDocument xmlDoc = new XmlDocument();<br />
XmlNode nSetting;<br />
string filePath;<br />
<br />
strmSettings = File.Open("options.xml", FileMode.Open);<br />
xmlDoc.Load(strmSettings);<br />
<br />
nSetting = xmlDoc.SelectSingleNode("/options");<br />
if(nSetting != null)<br />
filePath = nSetting.InnerText;<br />
<br />
strmSettings.Close();<br />
The string filePath will now contain the value from the Xml so you can do this:
<br />
XmlTextWriter writer = new XmlTextWriter(filePath + fileName, null);<br />
Obviously you should do some more error checking, but in the interests of simplicity this should get you up and running.
HTH
|
|
|
|
|
I FIGURED IT OUT! Thanks for you help...
It took me a while but, after tweeking you code out a little and a crash course on xml thanks to MSDN I got it.
XmlDocument xmlDoc = new XmlDocument();
XmlNode nSetting;
string filePath;
xmlDoc.Load("options.xml");
nSetting = xmlDoc.SelectSingleNode("//Options/entryFile");
filePath = nSetting.InnerText;
string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
XmlTextWriter writer = new XmlTextWriter(filePath + fileName, null);
I probably ghetoed this code out alot... but it works... I'll work on cleaning it up later... thanks agian!
/\ |_ E X E GG
|
|
|
|
|
Hey
I have the folowing cod:
try
{
//reading of logg file
StreamReader srlogg = new StreamReader(Application.StartupPath + "\\logg.bin",false);
BinaryFormatter bfstat = new BinaryFormatter();
arylogg = (ArrayList)bfstat.Deserialize(srlogg.BaseStream);
srlogg.Close();
}
catch.........
How could i do to avoid a message box that says error, the file .... .not found.
I fought first that srlogg maby sets to null when no file is not found, but the error comes already on the
StreamReader srlogg = new........
row, is there a good way to avoid error messages only for a file that are missing? I whant the try and catch if there will be other errors.
PS:
When the program starts, then all files is loaded, then thay ar updated after every change.
Best regards
Jimmy
|
|
|
|
|
You should be using a Stream derived class for the BinaryFormatter, not a TextReader derived class like you are using at the moment.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
if ( System.IO.File.Exists( Application.StartupPath + @"\logg.bin" ) )
{
...
}
|
|
|
|
|
Since the Winforms dialog controls do not allow must in the way of customizing (e.g. customizing the OpenFileDialog), I was wondering if anyone has seen any commercially available 3rd party controls that provide customized dialogs. I thought I've seen some one time on the web, but a google search hasn't helped me find it again.
Anyone?
mr
(this is a dup. of my post in the .Net Framwork forum, since I couldn't change the forum after the message was posted.)
|
|
|
|
|
|
Hi,
does somebody know about a native C# Control which is similiar to the outlook view of mails if you choose "View\Sort by Sender" ?
.:Greets from Jerry Maguire:.
|
|
|
|
|
There is a sorted listbox[^] on CP which may be what you're looking for.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
I have a simple project where I've derived my own class from System.Windows.Forms.TextBox. Then, in the same project, I created a form, added a textbox to it, and changed the type from TextBox to MyTextBox (my class name). It all compiles and builds fine. But when I try to open the form in Design mode, I get an error:
System.Runtime.Serialization.SerializationException: Could not find type 'MyTextBox'. Please make sure that the assembly that contains this type is referenced. If this type is a part of the your development project, make sure that the project has been successfully built.
Then the form appears without the textbox on it. How can I solve this problem?
Thanks in advance!
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Never do what you just described.
1.If your custom textbox is defined within a class in the project, the best thing you can do is to add your derived textbox programmatically, i.e.,
MyTextBox mtb=new MyTextBox;<br />
<br />
mtb.Location=...
2. In order to be able to visually use your derived textbox at design-time, you must build your custom textbox as a user control. That way you will be able to reference it and put it in the toolbox.
|
|
|
|
|
I want to set version information for my c# application and then be able to extract it and display it in a about box at runtime.
Some of the information I need you can define in the assemblyinfo file associated with a solution
eg.
[assembly: AssemblyTitle("Gradient Volume Calculator")]
[assembly: AssemblyDescription("Solvent Calculator for use by AS Software")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("XYZ")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("© XYZ")]
[assembly: AssemblyTrademark("XYZ")]
[assembly: AssemblyCulture("")]
and then access it using the FileVersionInfo command below
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(sFilePath);
x := myFileVersionInfo.LegalCopyright.ToString();
You can also Get Productname, FileVersion and InternalName, etc.
But HOW do you set things like ProductName, FileVersion, InternalName, FileDescription and Comments.
Am I missing an assembly reference or something?
Thanks in advance
Satvinder Basra
|
|
|
|
|
Looks like the attribute names not match up with the VersionInfo string names directly. Here are a few I mapped out:
ProductName = [assembly: AssemblyProduct()]
ProductVersion = [assembly: AssemblyInformationalVersion()]
FileVersion = [assembly: AssemblyFileVersion()]
Commants = [assembly: AssemblyDescription()]
Burt Harris
|
|
|
|
|
program mystery
String x;
Boolean f;
integer a, z,g;
x = readinput
g = length of x
z = g minus one;
a = zero
if g = 1 then f = 1
else
f = 1;
while (f=1 and a less than z)
while character at a of x is one of [whitespace,comma,semicolon, or full stop]
a++;
while character at z of x is one of [whitespace,comma,semicolon, or full stop]
z--;
if the toUpperCase of character at a of x is identical to
the toUpperCase of character at z of x
then a++ and z--;
else f=0;
if f=0 then print out appropriate message
else print out other appropriate message
any help would be apreciated cheers tom
|
|
|
|
|
Why not write it?
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
public void DoesSomethingIKnowNotWhat()
{
string x;
bool f;
int a, z, g;
x = Console.ReadLine ();
g = x.Length;
z = g - 1;
a = 0;
if (g == 1)
{
f = 1;
}
else
{
f = 1;
}
while (f = 1 && a < z)
{
while (x.Substring (a, 1) == " " ||
x.Substring (a, 1) == ";" ||
x.Substring (a, 1) == ".")
{
a++;
}
while (x.Substring (z, 1) == " " ||
x.Substring (z, 1) == ";" ||
x.Substring (z, 1) == ".")
{
z--;
}
if (x.Substring (a, 1).ToUpper () ==
x.Substring (z, 1).ToUpper ())
{
a++;
z--;
}
else
{
f = 0;
}
}
if (f == 0)
{
Console.WriteLine ("Appropriate message");
}
else
{
Console.WriteLine ("Other appropriate message");
}
}
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
Is there a nices way than this:
System.IO.Stream stream = irdaClient.GetStream();
int msglength = System.Net.IPAddress.HostToNetworkOrder(textBox1.Text.Length);
byte[] length = new byte[4];
length[0] = (byte)((msglength >> 0 ) & 0x000000FF);
length[1] = (byte)((msglength >> 8 ) & 0x000000FF);
length[2] = (byte)((msglength >> 16) & 0x000000FF);
length[3] = (byte)((msglength >> 24) & 0x000000FF);
stream.Write(length, 0, length.Length);
I think that the way with the byte array is not very nice! I think it's ugly !
The stream is a IrDA connection!
I have tried the StreamWriter class, but that doesn't work! The Server-Application receives some wrong things!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
If all you are trying to do is put the bytes of the int into the stream, why not use a BinaryWriter ?
This class has many overloads for Write().
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Thanks! I will try it!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hi there
I wonder how you play sounds(mp3) in C# in a good way?
|
|
|
|
|
It's possible to control WinAmp in order to play mp3s. There is some dll which allows you to do so.
Decoding mp3s is quite difficult I think and I read that you need an expensive licence to be able to access information about the internal format of mp3s. But I'm not quite sure
But WinAmp is freeware...
|
|
|
|
|
I made a ComboDataGrid (ParentControl). When the ComboBox (ChildControl) in the DataGrid has the Focus then I want to catch any Key Events from the ComboBox.
The ComboGrid should react as follows:
When the focused cell is not the ComboBoxColumn then the DataGrid should act normal, what means when the user presses Up or Down Arrows, the Focused Row chould change.
When the focused cell is in a ComboBoxColumn then it should be possible to press Ctrl+Up or Down Arrow to scroll up and down in the ComboBox.
To solve this I need any keyEvent of the ComboBox before the DataGrid. I tried with ProcessCmdKey(), ProcessKeyEventsArgs() but could not get what I wanted.
Big Thanks for all who will reply.
Stefan
|
|
|
|