|
Thank you Giorgi.
You always pass failure on the way to success.
|
|
|
|
|
what type of text box are you using?
- System.Windows.Forms.TextBox
- System.Windows.Forms.MaskedTextBox
- System.Windows.Forms.RichTextBox
|
|
|
|
|
SpacixOne wrote: 1. System.Windows.Forms.TextBox
Giorgi has provided a solution for me - thanks for asking.
You always pass failure on the way to success.
|
|
|
|
|
Hi guys,
I am trying to update an old application that was designed by another programmer. I am not very sharp at C# and need your help.
Can you please help me understand the following code that is in the windows service
IPHostEntry hostEntry=Dns.Resolve(m_sServerAddr);
IPAddress ipAddress = hostEntry.AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress,m_nPort);
m_svSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
m_svSocket.Bind(ipEndPoint);
m_svSocket.Listen(10);
while(true)
{
Socket rtSocket=m_svSocket.Accept();
if(rtSocket.Connected)
{
TD.WaitCallback myCallBack = new TD.WaitCallback(ProcessClientRequest);
TD.ThreadPool.QueueUserWorkItem(myCallBack,rtSocket);
}
}
ProcessClientRequest has a bunch of functions called like getschedule from database etc. I am trying to force Processclientrequest to reload the schedule from the database without restarting the service.
Please help.
Sameer
|
|
|
|
|
Wow, looks more like a coding horror to me...
People run that code on their PC??
|
|
|
|
|
no the service is installed on the server. It has run and currently runs great with no problems. What do you mean by coding horror? Also, the attached code is called by the timer. Here is the full function.
private void StartTimerAndServerSocket()
{
Writ2ErrLog("Service Timer Initialized");
string sErr="Application is ready for processing";
try
{
Writ2ErrLog(sErr);
m_tMonitor = new TD.Timer(new TD.TimerCallback(MonitorFunc),1, 0,45000);//45 sec
if(m_sServerAddr==string.Empty)
{
m_sServerAddr=Dns.GetHostName();
}
if(m_nPort==-1)
{
m_nPort=1024;
}
IPHostEntry hostEntry=Dns.Resolve(m_sServerAddr);
IPAddress ipAddress = hostEntry.AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress,m_nPort);
m_svSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
m_svSocket.Bind(ipEndPoint);
m_svSocket.Listen(10);
while(true)
{
Socket rtSocket=m_svSocket.Accept();
if(rtSocket.Connected)
{
TD.WaitCallback myCallBack = new TD.WaitCallback(ProcessClientRequest);
TD.ThreadPool.QueueUserWorkItem(myCallBack,rtSocket);
}
}
}
catch(Exception ex)
{
m_svSocket.Close();
m_tMonitor.Dispose();
sErr="Start Error " + ex.Message;
}
finally
{
if(sErr!=string.Empty)
{
Debug.WriteLine(sErr);
Writ2ErrLog(sErr);
}
}
Sameer
|
|
|
|
|
I have a class with three properties and i override the ToString method to return a concat of them.
now i'd like to have a textbox with a customsource foe the auto complete but i'd like to be able to type any one of the properties and show the relevant ToString output.
IE.
Item1.p1 = "Johnson"; Item1.p2="Chuck"; Item1.p3=50;
Item2.p1 = "Johnson"; Item2.p2="Michelle"; Item2.p3=20;
Item3.p1 = "Johnson"; Item3.p2="Joe"; Item3.p3=15;
Item4.p1 = "Joe"; Item3.p2="Black"; Item4.p3=10;
Item.ToString(){
return string.format("{0},{1}-{2}",p1,p2,p3);
}
now if you type John in the textbox id like to autocomplete to show (p1.tostring,p2.tostring and p3.tostring)
if you type "Joe" the drop down should have (p3.string and p4.tostring)
Any ideas?
|
|
|
|
|
cechode wrote: now if you type John in the textbox id like to autocomplete to show (p1.tostring,p2.tostring and p3.tostring)
Since John doesn't match your example, the autocomplete shouldn't work at all.
You would have compare each item to find a match anywhere in the string. Not very reliable since you will undoubtedly have duplicates.
only two letters away from being an asset
|
|
|
|
|
i dont have any duplicates in the list (a dup would be two items with both p1 and p2 equal).
essentially i'd like you to be able to type any value from any of the two properties (p1 or p2) but have the autocomplete (suggest) show you the Tostring of the object not what you type. ( real world example makes more sense )
|
|
|
|
|
You already have the answer, compare each item with a contains
only two letters away from being an asset
|
|
|
|
|
it's an answer but not to the current question.
thx for even reading it
|
|
|
|
|
Then what is the question? Be a little more specific, we aren't mind readers here.
only two letters away from being an asset
|
|
|
|
|
I think you're gonna have to create two auto complete sources and switch between them based on your criteria.
Dave
|
|
|
|
|
If I have a data file with a specific extension, and I register this extension to a C# executable. How can the program load the data file? I.e., I want to start the executable by double-clicking on an appropriate data file, and have the executable load that data file.
Thanks,
Tom
|
|
|
|
|
The name of the file is send as argument to the application. The args parameter of the main method is populated with the arguments that is sent to the application.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Perfect! Thanks.
Can I store a data file icon in the executable?
If so, how can I associate this icon with the (corresponding) data file?
modified on Friday, February 29, 2008 5:27 PM
|
|
|
|
|
fellas i am looking to do a loop that will loop constantly for 60 seconds inside a method before it will execute another instrcution insde the method
anybody any ideas how to carry this out
thanks
J2S
|
|
|
|
|
See timer for 5 seconds post below
only two letters away from being an asset
|
|
|
|
|
hi All,
I am trying to serialize a class with some composite classes.
heres the sample of XML I need
<classA>
<date>today</date>
<classB>
<name>Vicky</name>
<classC>
<name>Amber</name>
</classC>
</classB>
</classA>
Now I am accessing ClassB as property of ClassA, initializing in ClassA's Constructor.
Same way..classC will be initialized in ClassB's constructor and accessible through a property.
Now when I am trying to serialize I am not getting ClassB and ClassC...all classes and properties are public.
I am getting
<classA>
<date>today</date>
</classA>
Any suggestions???
Keep DotNetting!!
GeekFromIndia
|
|
|
|
|
Ensure that the classes B and C are marked as serializable. Ensure that the property "classB" within "classA" has both a public get and set members. This should be all you need to do.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Thanks Jeff...
I got it corrected...the problem was that my property was only a getter and not setter...
it seems a bit wierd that why we need to have both get and set to this...
Also I didnt mark any class serializable and still its working
but anyways its working fine...
Keep DotNetting!!
GeekFromIndia
|
|
|
|
|
Hi everyone,
I'm trying to develop a system using a mini guided vehicle to move form point A to B with co-ordinates derived from a G-mouse GPS receiver.The guided vehicle would interface with windows mobile pc( e-box 2300)and GPS,which would navigate the guided vehicle using gps data.The system would be programmed using C#.Can anyone give me tips or ideas or any help on how to proceed.I've been able to control the vehicles movement but not sure how to obtain co-ordinates with gps receiver.Any help no matter how small would be appreciated.
|
|
|
|
|
Can somebody send me timer code for 5 seconds? I need to put it so that form can wait to be closed for 5 seconds. I need to show the form for 5 seconds before closing.
Here is the code:
private void Form1_Load(object sender, EventArgs e)
{
this.Show();
int ret1 = 0;
int ret2 = 0;
ret1 = ConfigureSSE1();
ret2 = CreateLogin();
// Add code here to wait for 5 seconds to display the form which has Label, "Configuring..."
this.Close();
}
|
|
|
|
|
|
IMO this is a fairly useless form if all it does is call two methods then closes after five seconds.
You don't need the this.Show(), the form will automatically show (unless you've done something very bizarre)
There is a timer control available, plus other very easily discovered methods to have a thread wait. Try searching, then ask if you are stuck.
only two letters away from being an asset
|
|
|
|