|
I have a combobox that I fill during the form load. That works fine. The question I have is how do I make it say "Select An Item to autofill" or whatever? I understand I could use selectedindex or something like that but the actually text i wish to display by default is not in the list.
thanks wasn't sure what to search for on this
|
|
|
|
|
I would just add it to the combo data list and then set it to be the selected value. Nothing fancy.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
YEAH makes since to do it that way i guess, but the keywords are tied into each row on the database thats the only problem I have.modified on Sunday, February 14, 2010 3:46 AM
|
|
|
|
|
Hi, im just trying to send OSPF packets to a multicast IP address (224.0.0.5) but, usign raw sockets, windows 7 doesnt allow this type of sockets and using sharpcap i dont find the way to do that (send packets to a multicast ip address).
Please anyone who can help me ???
Im using C#......
|
|
|
|
|
When the connection between server and client break an event is raised,
I catch the event and null the client object but the client keeps on raising the event while it should be destroyed.
|
|
|
|
|
You did not post witch event so I am only guesing.
Maybe your event has e.Handled property. If so try setting it to true.
|
|
|
|
|
it's a custom event:
public delegate void kill(string msg);
public event kill Kill;
if (!clientSocket.Connected)
{
Kill("Server connection broken");
return;
}
Client clnt = null;
private void ms_Startclient_Click(object sender, EventArgs e)
{
if (ms_Startclient.Checked)
{
clnt = new Client();
clnt.Kill += new Client.kill(clnt_Kill);
}
else
{
clnt = null;
}
}
void clnt_Kill(string msg)
{
clnt = null;
MessageBox.Show(msg);
ms_Startclient.Checked = false;
}
|
|
|
|
|
the only thing that could affect yours is that line Kill("Server connection broken"); is being called more than once
|
|
|
|
|
Why dont you just remove the delegate?
void clnt_Kill(string msg) <br />
{ <br />
clnt.Kill -= new Client.kill(clnt_Kill);<br />
clnt = null; <br />
MessageBox.Show(msg); <br />
ms_Startclient.Checked = false; <br />
} Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
You should implement the dispose pattern[^] and dispose of the object. Setting it to null only flags it as being available for cleanup when garbage collection comes around, which you have no idea when will happen. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Your teacher told you to pay attention and not destroy the class.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I don't know whether I am asking a stupid thing.
I can develop an application that can read emails for me and can send SMS alerts for every new mail.
That application keeps on monitoring my inbox. But I want it to execute 24 hr a day.
Is it possible to make an exe executing all the time online in some other online service or machine.
Something like a program running in cloud(cloud computing)
|
|
|
|
|
Whell, any process can run 24 hours a day 365 days a year. All you need to never close or terminate process or shut-down computer. If you attempt to create process designed for monitoring, then I recommend you to create services.
Gjm wrote: Is it possible to make an exe executing all the time online in some other online service or machine
Normal monitoring application/services needs to be installed on a computer/machines that is supposed to be used.
|
|
|
|
|
You might be looking for a windows service.
Just check whether creating a Windows Service will help you or not.
|
|
|
|
|
Don't post the same question to multiple forums I know the language. I've read a book. - _Madmatt
|
|
|
|
|
this is the code segment i used
int? x = null;
int? y = null;
if (x >= y)
{
Console.WriteLine("x is greater than y ");
}
else
{
Console.WriteLine("x is less than y ");
}
as i read if you compare two nullable types that both are having null it should be true, but i get the false (as in the code "x is less than y " )
can anyone tell me why ?
|
|
|
|
|
If both are null, operator >= can't compare, because it doesn't have value.
prasadbuddhika wrote: as i read if you compare two nullable types that both are having null it should be true
I think if you compares with operator == (Equal) it would be true, because both would be equal.
prasadbuddhika wrote: ut i get the false (as in the code "x is less than y " )
if first block is false then your else block would run instead. However what you want is use this:
if (x > y)
{
Console.WriteLine("x is greater than y ");
}
else if (x < y)
{
Console.WriteLine("x is less than y ");
}
Eidt: Forgot pre tagsmodified on Saturday, February 13, 2010 11:01 AM
|
|
|
|
|
I recommend you avoid all nullable compares other than aNullable == null
how to compare nullables needs careful definition.
And it has been established C# and VB.NET use different definitions for it!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi,
This alternative test clarifies what is going on and I think the take home message is that nullable types must contain a value before a comparison can be made. It's very confusing when x == y is true but x >= y is false and I'm sure this will catch many people out.
static void Main(string[] args) {
int? x = null;
int? y = null;
Compare(x, y);
x = 1;
Compare(x, y);
Console.ReadLine();
}
private static void Compare(int? x, int? y) {
Console.WriteLine("{0} >= {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x >= y);
Console.WriteLine("{0} > {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x > y);
Console.WriteLine("{0} == {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x == y);
Console.WriteLine("{0} < {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x < y);
Console.WriteLine("{0} <= {1} {2}", x == null ? "null" : x.ToString(), y == null ? "null" : y.ToString(), x <= y);
Console.WriteLine();
}
Alan.
|
|
|
|
|
I suggest you perform a similar test using VB.NET and compare results. They made really surprising decisions when introducing nullables.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I was going to give an excuse about not having the compiler installed but I knew I'd never get that past you. The best I could do with the VB 8.0 compiler, not having used Basic since 1993 was
Class Sample
Public Shared Sub Main()
Dim x as Nullable(Of Int32): Dim y as Nullable(Of Int32)
x = Nothing: y = Nothing
Compare(x, y)
x = 1
Compare(x, y)
x = Nothing: y = 1
Compare(x, y)
Console.ReadLine()
End Sub
Public Shared Sub Compare(x as Nullable(Of Int32), y as Nullable(Of Int32))
Dim xvalue as String: Dim yvalue as String
If x.HasValue Then
xvalue = x.ToString()
Else
xvalue = "Nothing"
End If
If y.HasValue Then
yvalue = y.ToString()
Else
yvalue = "Nothing"
End If
Console.WriteLine("Nullable.Equals({0}, {1}) {2}", xvalue, yvalue, Nullable.Equals(x, y))
Console.WriteLine("Nullable.Compare({0}, {1}) {2}", xvalue, yvalue, Nullable.Compare(x, y))
Console.WriteLine()
End Sub
End Class
Nullable.Equals(Nothing, Nothing) True
Nullable.Compare(Nothing, Nothing) 0
Nullable.Equals(1, Nothing) False
Nullable.Compare(1, Nothing) 1
Nullable.Equals(Nothing, 1) False
Nullable.Compare(Nothing, 1) -1
So the difference is that C# relational operators and the Nullable.Compare method give different results?
Alan.
|
|
|
|
|
Alan N wrote: I knew I'd never get that past you
You're right
Here[^] is my take on the "Nullable Comparison" issue.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Saturday, February 13, 2010 4:36 PM
|
|
|
|
|
Here[^] is my take on the "Nullable Comparison" issue. I can't explain why it does what it does, I can only observe and live with it.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
thank you for all who replied me , i read an article about nullables in MSDN site, and i didn't get the expected result when i test them , that's why i posted it here , now i see there are problems using nullables.
|
|
|
|
|
I am trying to drag a form by a panel control (because i removed the form border).
But i am not having any luck,
Any suggestions?
|
|
|
|