|
oh, I don't know then. Sorry.
/\ |_ E X E GG
|
|
|
|
|
Is anyone aware of a control for entering TimeSpans ? I found this one[^], but unfortunately this is for ASP.NET not for Windows Forms.
It doesn't matter whether for .NET 1.1 or 2.0.
I already thought about using DateTimePicker in time-only-mode, but I also want to be able to enter days and this is not possible with the DateTimePicker .
Maybe some masked TextBox control with a certain mask?
Any ideas?
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
Could you perhaps use two DateTimePickers to specify start and end time? That way you could specify an arbitrary duration...
Just a thought,
mav
|
|
|
|
|
Hello,
I've added some code to use the macromedia flash player (flash.ocx) to my windows forms application.
If the flash player is not installed on my clients pc it will crash the application.
How can I programmatically determine if the flash player is already installed and execute the flash code based on the condition if the flash player is installed or not.
thx!
|
|
|
|
|
At what point does your application crash? If it is after you've executed some of your own code, you ought to be able to use try/catch or other error handling mechanisms built into .NET to catch whatever error is causing your crash. At that point, you should be able to detect that the player isn't present.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Yes, I know the try catch is a possible solution.
That's also how I implemented it at this time to avoid the possible crash of the application.
(application crashes when I call the code to play the flash swf file)
I don't like relying on the try catch statement.
I think it should be possible to determine if the flash player is installed and only execute the code to play the flash file if the flash player is installed. (otherwise display image)
|
|
|
|
|
Hi, I have created a .Net Applet that connects to an FTP server via sockets. The problem is that the connection to the socket takes a long time (at around 100+ seconds). I tried creating an implementation of the FTP class in a Windows Form and I got connected faster (roughly 1-3 seconds).
Are there issues when connecting/opening sockets in .Net Applet?
sample code
public Boolean Login()
{
// Create socket
m_objClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
// Create IPEndpoint
IPEndPoint ep = new IPEndPoint(Dns.Resolve(m_sRemoteHost).AddressList[0], m_iRemotePort);
try
{
// Connect Socket takes a long time in applet
m_objClientSocket.Connect(ep);
}
catch(Exception ex)
{
MessageString = m_sReply;
throw new IOException("Cannot connect to the remote server. Error: " + ex.Message);
}
.......
|
|
|
|
|
You might get better answers if you post in the windowsforms.net forums. .NET 'applets' are so sparingly used, it seems to me that most people will have no idea why it works slower over the web like this.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: The Secular Left, the Religious Right, and Prejudice
Judah Himango
|
|
|
|
|
A GUI have many controls, such as radiobutton, checkbox etc.
After configurate GUI, click "OK" button, how to save current configuration?
ths!!!
|
|
|
|
|
dogdogdog wrote:
how to save current configuration?
However you want to save it. The .NET framework does not dictate how your application should work that is a design issue for you to resolve. If you tell us where you would like the configuration information to be saved then maybe we can help you.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
hi,
You have to use XML to do this.
suppose that you click radio button and current configuration of it is "ok".
Then you have to save Radiobutton name and "true" in the XML File.
pl use System.Xml namespace for it.
after that you load application once again,You have to read current status of Radio Button and set it to radiobutton..
regards,
pubudu.
|
|
|
|
|
You have to use XML to do this
Why do you HAVE to use Xml? You COULD use Xml, you COULD use a serialised object, you COULD use a database but you certainly don't HAVE to use Xml.
Personally I have used an object serialized to the filesystem for this. It is very simple - create a class to represent all the properties of the gui you wish to store, remember to mark it as [Serializable].
When the app is unloaded fill a new instance of your "settings" object with the values from the gui and use a serializer (Xml or Binary or any type you wish) to serialize to the filesystem.
When the app is loaded do it in reverse, deserialize the file back to an object and set the properties on the GUI.
|
|
|
|
|
hi,
I have used XMLDocument to save current status of Application Controls.I haven't use Serialization or No need to use database for that.
To do serialize You also need to use XML.
regards,
pubudu.
|
|
|
|
|
IMHO J4amieC says that you presented XML as it was the *only* option. While I agree that XML is cool and XML rocks, it is not the *only* option.
pubududilena wrote:
To do serialize You also need to use XML.
Not at all. You can have binary serialization.
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Thank you very much.
Yes, use xml or binary file can save gui configuration.
If a whole form can be serialized, it is a perfect.
|
|
|
|
|
Hi all!
I'd like to make one of my c# apps a COM server and don't have a good idea on how to do it.
Creating a .NET dll containing a COM-visible class and calling this class from a COM client is easy and works fine, but so far I couldn't find a way to do this for a .NET executable.
When I set the output type to windows executable, the "Register for COM interop" flag is not honored.
Calling regasm works for the dll as well as the exe, though.
Instantiating a class in a COM client does work as long as the dll is registered. When I build the exe, call regasm and re-run the same COM client (a simple VBScript) I get the error 0x80070002 (file not found) when calling CreateObject().
Any idea/advise?
Thanks in advance,
mav
|
|
|
|
|
It may be possible to correct the 0x80070002 error by manually editing the registry key to use ".exe" instead of ".dll", which is likely written in by the .NET Framework during registration. However, if the framework does that, it may have issues trying to run a .exe as a COM server?
Anyway, why do you need the EXE instead of a DLL? Explain that, and we may be able to offer a better solution, while still using a dll.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Thanks, John, for taking your time!
I want an EXE because I already have an executable (a Windows Forms Application) that I want to enrich by making it a COM server.
The goal is to make methods/properties of the running instance of the application visible to COM...
Perhaps I could move all the functionality into a class library and only put the startup code into the exe itself, but then I guess I'll get a new instance of my form class when I instantiate a COM object from the class library and cannot access the running form itself.
Thanks in advance for anything you can come up with.
Regards,
mav
|
|
|
|
|
I want to be careful about my advice here. I'm not sure whether you can't do what you want with a .NET exe. However, there are some other options, if that truly doesn't work.
1.) Create a COM server in unmanaged code, but it simple passes off the work to the .exe that you have already written. (Not as much work as re-writing, but still a bit of work, I bet. You'll have to figure out how the communication would take place.)
2.) Use one or more of the different ways that you can operate multiple dll instances as if they were one shared instance (or actually share the same dll). One of the ways to handle this is with shared memory mapped files, and named events.
3.) Create an unmanaged COM server exe, and make it actually contain (wrap) your existing application. (Managed C++ would work well for this, I think.)
4.) Don't forget that you may still be able to make the .exe into a COM server.
5.) A re-think of #2 is that you could make a dll COM server, that uses sockets or interprocess communication to communicate with the .exe that you want to really use. That way, you could have multiple instances of the COM object, but they would all be communicating with the single exe, acting as one instance.
6.) Brainstorm a bit more!
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Can somebody tell me how I can insert text from TextBox-es to DataGrid using C# and (InsertCommand) dhe (UpdateCommand) same time deleting from DataGrid (DeleteCommand)
HElp!!!
|
|
|
|
|
hi,
You can Update dataGrid Like this:
DataSet ds=new DataSet();
System.Data.SqlClient.SqlDataAdapter ada,dt1;
ada=Get data for adapter object
ada.Fill(ds);
this.dataGrid1.DataSource=ds.Tables[0].DefaultView;
System.Data.SqlClient.SqlCommandBuilder sqlcom=new SqlCommandBuilder(ada);
dt1=sqlcom.DataAdapter;
//Update changes in the datagrid
DataTable tt=ds.Tables[0].GetChanges();
dt1.Update(ds);
regards ,
pubudu.
|
|
|
|
|
Insert into the DataSource and Refresh() on the DataGrid
|
|
|
|
|
MY program is supposed to send a file asychronously via TCP and sockets, to this end i grab
chunks of the file and store it in a data class, which i serialize and send.This is then
deserialized and the data block is placed in the correct spot in the file by offseting the
stream to the appropriate spot.
ok to the error , this process works the first couple of types with atleast the first 2
chunks of data being recieved and placed in a file on the other side. However after that
things go pear shaped, as once one goes wrong all the remaining chunks no longer work all
giving similar errors.
1 //<< this is my sequence number i use to find offset values
0 //<< current offset in file
got to reciever
got to tryrec
2 //<< this is my sequence number i use to find offset values
1024 //<< current offset in file
got to reciever
got to tryrec
A Exception occured in file transferSystem.Runtime.Serialization.SerializationException: The
input stream is not a valid binary format. The starting contents (in bytes) are:
6C-65-2E-52-65-61-64-4C-69-6E-65-28-29-3B-0D-0A-0D ...
at
System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Read(__BinaryParser
input)
at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadSerializationHeaderRecord(
)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage
methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream)
at SocketSystem.Program.MessageHandlerServer(CSocketClient pSocket, Int32 iNumberOfBytes)
in c:\documents and
settings\rob\desktop\socketsystem\socketsystem\socketsystem\program.cs:line 274
got to reciever
my data class
[Serializable]<br />
public class DropBear<br />
{<br />
public int SequenceNo = 0;<br />
public string misc = "";<br />
public byte[] buff = null;<br />
<br />
}
---------------------------------------------------------------------------
now for my serialization code
DropBear db = new DropBear();<br />
db.buff = buffered;<br />
db.SequenceNo = filt.currSeqNO++;<br />
BinaryFormatter bf = new BinaryFormatter();<br />
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, db);
Byte[] by = ms.GetBuffer();
//data sent as Byte[] << byte buffer size 10240
//file chunk 1024
----------------------------------------------------------------------------
Deserialization
MemoryStream s = new MemoryStream();<br />
s.Write(pSocket.GetRawBuffer, 0, pSocket.GetRawBuffer.Length);<br />
BinaryFormatter bf = new BinaryFormatter();<br />
s.Position = 0;<br />
DropBear db = (DropBear)bf.Deserialize(s);
-------------------------------------------------------------------
the data is sent with a network stream, i have tryed resetting the buffer at the end of
every read and before every recieve
Any input would be appreciated.
Thanks Rob
|
|
|
|
|
Before reading from the MemoryStream do
ms.Seek(0, SeekOrigin.Begin);
I was getting similar errors. This solved the problem.
|
|
|
|
|
i have a MainForm that act as a MDI container, i load the company logo as backgroundimage, but the image is load as tile mode which fill all the MDI container, is there anyway to set the background image to the center of the MDI container instead of tile?
|
|
|
|