|
Thanks for you help. That is excactly how I had it coded, I just wasn't sure why I was having the problems. I even tried using
bool mem = false;
if(mem)
{...
}
else
{...
}
and it did the same thing.
|
|
|
|
|
Is your project building? If you have an incorrect version the debugger will still step but perform strange actions. Very confusing but it happens.
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage
|
|
|
|
|
TWatson47 wrote: int Mem = 0;
if (Mem ==1)//for true
Not trying to second guess your logic, but why wouldn't you want to use a bool type variable to do this?
bool mem = false;
if (mem) {
lbMember.text = applicant.getfname() +" "+ applicant.getlname();
lbAdd.Text = address.getAddress();
} else {
lbMember.text = "not selected";
} Why co-opt an int ? That's a retro, "C"-type thing to do...
Just wondering.
Sean
|
|
|
|
|
I am new to C# I use to write in C++. Your idea looked good, however, I am still having the same problem. I am still get a false reaction even though it is true. I am getting a read out of "not selected" when it should be the members info.
Any suggestions, it looked like you where on the right path.
Thanks for the help
|
|
|
|
|
Are you saying you want to base your if/else on user input?
If so you can add a radio button with yes and no and do something like this
<br />
if (rbMember.SelectedItem.Text == Yes)<br />
{<br />
}<br />
else<br />
{<br />
}<br />
<br />
|
|
|
|
|
TWatson47 wrote: how do I get it to make the selection of choice from where the data is put in.
I'm not sure what you mean ? If you mean the UI provides the case, use a checkbox.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
The code that you are showing is perfectly valid, and will never have the problems that you are talking about.
Therefore:
:: Your code is different in some way from the code that you have shown.
:: Either the variable doesn't contain what you think it does, or you are doing the comparison wrong.
---
b { font-weight: normal; }
|
|
|
|
|
Your question interests me. What value are you storing in the database to indicate it is a joint or individual loan?
|
|
|
|
|
okay what it sounds like is that you are trying to get data from a database and use that value to do a specific action you obviosly need someway of obtaining that data from the database i don't know how you have this information stored but if its in some sort of class then you would do something like
<br />
if(Loan.JointAccount == "MyWife")<br />
{<br />
do logic here<br />
}<br />
else<br />
{<br />
do non joint logic here<br />
}<br />
|
|
|
|
|
Hi,
i think i got ur question.
wat about adding a checkbox to your form.
when it is selected you can set the value to true and take steps accordingly.
and if its not selected ie. false and you can perform the steps for false value.
hope this works.
Nitin...
|
|
|
|
|
so If I'm doing a BeginReceive on my client socket....can I just to a regular send for sending data or do I need to do a BeginSend to make my client socket app truly async?
Also if I want to fire an event when data comes in ...and I want to pass the incoming data with my event....do I want to do that after I call my EndReceive?
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
For firing the event when data comes in, you'll have to do that after you call EndReceive, or you won't know how much data you received (and possibly your buffer will not have the data - can't remember off-hand).
I've always used regular sends for sending data, and BeginReceive/EndReceive on the receiving end. I don't know if this really makes async, but I never quite understood the reasons for the overhead involved with BeginSend/EndSend - regular Send has always worked just fine for me.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
Do I need to block on my send when sending?
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Hello
Tom Wright wrote: I need to do a BeginSend to make my client socket app truly async?
Sending and receiving are two different operations. If you send using Send() method and recieve using BeginReceive() method, then your sending will be blocking, or sync opertation while recieving is not!!
For me, I prefer using multithreading. This is what really happens in the background. The Begin methods actually make a thread for you to do the job. Well, I like to have a control over my threads, even if I have ot write few more lines!!
So, my advice, Make a thread for each socket to handle sending/receiving data. A better more advanced approach -needs more care though- is to make two threads for each socket. One to send and the other to receive.
Regards
|
|
|
|
|
The problem is (I have this now) that when doing seperate threads for send and receive, I cannot seem to get the correct status of the socket back. So if the connection drops....ungracefully. My app never knows and keeps trying to send. So one way to get around this is to use the BeginSend and BeginReceive.
Do you have any other suggestions? Thank
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Hello
Sure!! There are plenty. You may check the status of the connection using the Connected property, or even set a timeout of the send operation using the SendTimeOut property to a reasonable value.
Regards
|
|
|
|
|
been there done that....If I send data...it sends it,not sure to where and the connected property only return the status of the connection from the last io on the port.
I've tried poll and ...one other method that escapes me.
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Hello
Quoted from MSDN:
If you need to determine the current state of the connection, make a nonblocking, zero-byte Send call. If the call returns successfully or throws a WAEWOULDBLOCK error code (10035), then the socket is still connected; otherwise, the socket is no longer connected.
Try to use this non-blocking BeginSend() call just to check the current status.
I hope this helps.
Regards
|
|
|
|
|
Greetings again!
I have a question concearning delegates:
How to use a delegate which is passed by another class.
Here the exemple code, which shoould explain my question:
<br />
delegate void dSendParameters(string para);<br />
and in the Method
<br />
dSendParameters dSend = delegate(string para) { };<br />
Classes.OtherClass otherclass = new Classes.OtherClass(dSend);<br />
and her the code in the other class, which should "catch" the delegate
<br />
public class OtherClass<br />
{<br />
public OtherClass(Delegate dSend)<br />
{<br />
}<br />
<br />
private void buttonClickme_Click(object sender, EventArgs e)<br />
{<br />
}<br />
}<br />
With Parameters it´s easy, just pass a ref and create a Parameter which get´s the value of the ref Parameter. But how to make a delegate available this way??
I need this, because I need to make referenced Assemblies able to call Methods of the
executing Assembly.
Thanks in advance,
ezazazel
|
|
|
|
|
Your code can benefit from a better approach at the problem but I will give you a simple solution
public class Foo{
public delegate void dSendParameters(string para);
public event SendParameters;
protected virtual OnSendParameters(parm list){
if(SendParameters != null){
SendParameters(someString);
}
}
private void buttonClickMe_Click(object sender, EventArgs e){
OnSendParameters(someparams);
}
}
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage
|
|
|
|
|
Thx for your sample code.
One more question if I may:
how to make the delegate from the exe to the delegate in your foo class
<br />
public delegate void dSendParameters(string para); <br />
public event EventHandler SendParameters;<br />
public OtherClass(Delegate dSend)<br />
{<br />
<br />
}<br />
Or did I missunderstand your code? If so, I´m sorry.
Thx in advance
-- modified at 16:00 Thursday 24th August, 2006
|
|
|
|
|
This maybe? I don't really understand the question.
public class SomeOtherCode{
public void SampleMethod(){
Foo foo = new Foo();
foo.SendParameters += new dSendParameters(SomeMethod);
}
public void SomeMethod(string param){
...
}
}
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage
|
|
|
|
|
I mean this:
public delegate void dSendParameters(string para);
public event SendParameters;
public OtherClass(Delegate dSend)
{
//this.SendParameters += dSend;
//or
//dSendParameters += dSend
}
which doesnt´t work
What I want is:
Assembly a (executable), Assembly b(dll)
b is referenced in a
a has a method which needs to be called by b
so I send a delegate to be when I call the class
the sent delegate is invoked inside b
Thx
|
|
|
|
|
public delegate double DFunction(double d);
public double Sin(double d){
return Math.Sin(d);
}
public double PerformAction(DFunction d){
double e = d(5d);
return e;
}
private void button1_Click(object sender, EventArgs e) {
PerformAction(new DFunction(Sin));
}
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage
|
|
|
|
|
You can hold the delegate as a field like any other object:
public class OtherClass {
private dSendParameters _dSend;
public OtherClass(dSendParameters dSend) {
_dSend = dSend;
}
public void SomeOtherMethodCallingDSend() {
_dSend("SomeParam");
}
}
|
|
|
|