|
I want to read a date string from a log file it is in this format ...
17/Apr/2003:06:40:39 +1000
I would like to parse this then display it as the local time format.
I am lost in the world of Globalization
James McCutcheon
|
|
|
|
|
Found my own solution ... in case anybody else wants to know:
activitytime = "01/Apr/2003:11:01:02 +1000";
DateTime dt = DateTime.ParseExact(activitytime, "dd/MMM/yyyy:HH:mm:ss zzz", new System.Globalization.DateTimeFormatInfo());
|
|
|
|
|
James McCutcheon wrote:
Found my own solution ... in case anybody else wants to know:
I always appreciate people posting their solutions if they find them. Then if someone else with the same problem comes across the same problem and finds your post, they can know the solution, too.
"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 created the following class:
public class Mobile : IDisposable
{
private TcpListener tcpListener
public Socket sockToClient
}
public Mobile (string Remote_Ep)
{
IPHostEntry hoen = Dns.Resolve(Remote_Ep);
IPEndPoint ep = new IPEndPoint(hoen.AddressList[0], 11000);
tcpListener = new TcpListener(ep);
tcpListener.Start();
Thread t = new Thread( new ThreadStart(thread_proc_IO) );
t.Start();
}
private void thread_proc_IO()
{
bool fDone = false;
while( !fDone )
{
try
{
Console.Write("\n[tid {0}]: Listening on port {1}", GetCurrThread.id(), mb_frs_port );
sockToClient = tcpListener.AcceptSocket(); // @@@
if( sockToClient.Connected )
{
Console.Write("\n[tid {0}] Client connected", GetCurrThread.id());
ClientHandler Handler = new ClientHandler(sockToClient);
Handler.StartRead();
}
}
catch (Exception ex)
{
Console.Write( "\nMobile.thread_proc_IO: [tid {0}] Exception in I/O thread - exiting. " + ex.Message, GetCurrThread.id() );
fDone = true;
}
}
}
I am creating several instances of this class, and adds every instance to ArrayList.
When I am trying to remove one of the instances, removing it from the ArrayList is not enough
I am trying to use dispose, sockToClient_dbg.Shutdown(SocketShutdown.Both), sockToClient.Close(), tcpListener.Stop() but nothing seem to work.
I also read about this bug located at www.dotnet247.com/247reference/msgs/1/8442.aspx :
"The TCPClient has some known bugs. One of them is that a TCP-connection is
NOT closed - when you call .Close(), .Dispose() method. I spent a long time figuring this out. I used Sockets instead at it all worked perfectly...."
Does anyone has any idea how to kill this socket ?
|
|
|
|
|
I'm a java programmer and am learning C# and liking it. In java I was able to create custom renderers that I could use to display a panel with a bunch of labels adn text boxes and pictures in a single slot in a list.
I want to do the same thing in c#. I want to create a class that is a panel and will contain a couple textboxes and labels. I want all this to be shown when I add it to the listbox, not the tostring method to be called and the text to be displayed. So I'm pretty much looking for a way to display a panel in a listbox slot.
If anybody has an example, advice, a better solution, or knows if this is even possible please post.
I'll continue my searching of the web and experimenting.
Thanks
Bryan
|
|
|
|
|
I think you can create your own drawing handler class that implements a certain interface and assign that to the listview's CustomDrawHandler property.
I probably should check before "sending you on a wild goose chase".
"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
|
|
|
|
|
Hi,
I am pretty new to C# and VS.NET, and I need to use a Webform with textboxes where I send values to/from an Access database. I am not sure what I need to use of the following: OleDbDataAdapter/OleDbConnection/DataSet/OleDbCommand?!
How do I directly send a textfield from the webform into the access database form? Any tips/resources please?
Trond Borg.
|
|
|
|
|
// This connection string is off the top of my head, i know its wrong but kind of it, check
// www.connectionstrings.com and click on access oledb for the right one.
OleDbConnection conn = OleDbConnection( "Provider=Microsoft Jet 4.0";Data Source=C:\\db.mdb;User=peter;Password=cat" );
OleDbCommand comm = new OleDbComm( "", conn );
comm.CommandText = "UPDATE [tableName] SET ( [columnName] = " + textbox.Text + " ) WHERE ( [columnName2] = 'ID' );" ;
conn.Open();
comm.ExecuteNonQuery(); // i think this is the method name, should be obvious with auto-complete
conn.Close();
you said: "into the access database form" hope you mean table, into a form i dont think u could, have no idea.
|
|
|
|
|
I would like to convert a DateTime to double.... How I can do that?
I wanted to use Convert.ToDouble(DateTime) but is not supported yet and I receive a invalidcastexception.
Thanks!
|
|
|
|
|
What about getting the Ticks from the DateTime and converting that to a double. Is that what you need?
Regards,
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
|
|
|
|
|
I am currently trying to get a combo box to select by default a value that I have recieved in a constructor from another form. I have tried everything that I can think of. I am sorry I feel like this is one of those easy questions but just cannot find the answer. If any one has any suggestions I would be greatly appreciated.
Thanks
Corey Embry
at first I tried this
ItemLoc = cbxManufacturer.FindString(MfgName);
cbxManufacturer.SelectedIndex = ItemLoc;
Then I tried this
cbxManufacturer.SelectedItem = MfgName;
then I tried this
cbxManufacturer.SelectedText = MfgName;
and finally I tried this
cbxManufacturer.SelectedValue = "2";
I am just plain out of ideas so if anyone can help I would be very greatful.
|
|
|
|
|
Corey Embry wrote:
ItemLoc = cbxManufacturer.FindString(MfgName);
cbxManufacturer.SelectedIndex = ItemLoc;
This should work, MSDN even has this as an example. Are you sure both MfgName and ItemLoc are valid?
|
|
|
|
|
ItemLoc is not being populated with a correct value MfgName is correct from a dropdownlist on a pervious screen however when I run it against this dropdown it will not sync it gives 0xffffffff location eventhough the text is contained in the drop down list.
|
|
|
|
|
Hi , ive just installed vs.net 2003
and im about to create a c# win app for pocket pc.
the problem is , that my app needs to be connected to the internet ,
so does anyone have any idea how to make the pocket pc EMULATOR think that it is online or connected to our network???
and humm , maybe this wasnt the correct forum (?)
//Roger
|
|
|
|
|
That's what the loopback adapter[^] is for IMHO.
|
|
|
|
|
no its not (?)
what do i need to do on the emulator to be able to connect it?
no network settings sticks , it drops everything every time its started
is there anyone who have actually done this?
//Roger
|
|
|
|
|
What does this error means?
An object reference is required for the nonstatic field, method, or property 'istatistik.Form1.process()'
Thanx in advance...
|
|
|
|
|
it means you are trying to call the function "process" which is only accessable if you create an instance of the object - prob Form1
Form1 form = new Form1();<br />
form.process();
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
How do I set an auto recovery for an Windows NT Service?
I want to restart the service automatically when it fails for some reason.
In Administrative Tools->Services-> select a service and see "Recovery" proterty tab.
There are ways to "restart the service" after failures.
How do I do it programatically?
Any Idea. A solution in C# or VB will be ideal, but C++ will also do.
I could n't find a way to do this.
Heelp !!!
Swarup Das
|
|
|
|
|
when i add a child form in an mdi form; and when i try to resize the mdi form scrollbars appears horizontally and vertically, i tried to vanish these autoscroll bars but i coudnt find the right property....
can anyone give me a suggestion?
|
|
|
|
|
[C# Windows Application]
When I make reportform that use .Net CrystalReport Component,
Should I do Create Designed DataSet(Support DataBase Schema) so that We use Drag-and-Drop Fields in Field Expoler?
What method do I make reportform use Drag-And-Drop in Field Expoler without creating Design Type DataSet?
|
|
|
|
|
Two questions.(dummy)
1. If there are number of namespaces included in a project, how to know which namespaces are used?
2. Is there any overhead if I referenced namespace and but not called any of the types included in that namespace?
Don't and drive.
|
|
|
|
|
Kant wrote:
1. If there are number of namespaces included in a project, how to know which namespaces are used?
If they're your namespaces that you created, pop open the object browser or Reflector[^]
If they're namespaces from the Framework, then you can look at the metadata in ILDASM or Reflector. To do it in Reflector, pop open the Assembly and click on the References item.
Kant wrote:
2. Is there any overhead if I referenced namespace and but not called any of the types included in that namespace?
IIRC, no. Because the Compiler optimizes away the unused namespaces. However, why reference a namespace that you aren't going to use?
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
David Stone wrote:
why reference a namespace that you aren't going to use?
Actually I need to change the code and the developer who wrote it, is gone. For a person like me whose experience is in C++/MFC, the C# code looks like greek to me.
Thx for the Reflector tip.
Don't and drive.
|
|
|
|
|
Namespaces are just ways of giving classes long names. So, when you write:
namespace utility
{
class Test
{
{
}
You're really just creating a class named utility.Test.
The unit of physical organization is the assembly, which sometimes map to specific namespaces, sometimes contain more than one namespace, and sometimes contain only part of a namespace.
The answer to #2 WRT assemblies is "no", there is no overhead if you reference an assembly but don't use anything from it.
|
|
|
|