|
|
|
i m having a mdi form which displays a main form on its load containing a datagridview with users detail...and a add form on click of its toolstrip which adds new users record...i want to refresh my main form datagridview when a new record is added....i did
void AddNewRecord_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
{
MDIDiary.Main mn = new Main();
mn.loadPage();
}
this but it is not refreshing please help...loadpage() is a function which displays the users record on datagridview(bind the datagridview)...please someone help
|
|
|
|
|
Use this.owner.loadpage()
or this.parent.loadpage()
Best Regards,
Chetan Patel
|
|
|
|
|
but loadPage() is not a function of this parent...its a function of Main form..which is displayed on load event of the mdi form...so please help
|
|
|
|
|
Hi All,
Im right now working in Window Application using C#.
Is there any way to include another windows Application(written in VC++ having UI also) in my Application.
With Regards
Amjath
|
|
|
|
|
Maybe through a dll, not too sure...
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
How do you mean, include ? You can include anythign as a resource, but what do you want to do with it ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi First of all thanks for u response.
i have a Application written in vc++ window based(its some what black box to me).
i want to use that application in my c# window based application is it possible.
with Regards
Amjath
|
|
|
|
|
OK, that's SO not what you asked.
No, you can't really do this in a way that would be sturdy enough to release. You could make it work, by embedding the second exe inside the first but
a - they would run independant of each other and
b - it wouldn't be guarenteed to be stable
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi All,
I'm finding it hard to find an example of a switch statement i'm trying which I think may mean I'm being stupid with it.
I have two string, string1 & string 2 which I want to compare and return a single result.
Like
switch(string1, string2)
case string1 == string2
return string1
case string1 != string2
return string2
default
return string3
Should I be using if ...else ... if else?
Cheers,
Jammer
Going where everyone here has gone before!
|
|
|
|
|
Hi,
return (string1 == string2 ? string1 : string2);
Since (a == b AND a != b) will never be true, a default is not necessary.
Matthew Butler
|
|
|
|
|
Thanks for the reply. Not sure I follow so I'm going to have to have a play. What are the ? and : characters saying in your example?
Jammer
Going where everyone here has gone before!
|
|
|
|
|
Basically...
condition ? result_if_true : result_if_false
so...
(true ? "yes" : "no") ... would be equivelent to "yes".
(false ? "yes" : "no") ... would be equivelent to "no".
for example (brackets not necessary but it makes it clearer)...
string result = (a == b ? "same" : "different");
Hope this makes it clear.
Matthew Butler
|
|
|
|
|
Hi,
return string2; // unconditionally!
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Wow... that's a definate sign it's getting late.
Seems obvious now.
Matthew Butler
|
|
|
|
|
Jammer wrote: Should I be using if ...else ... if else?
Yes.
|
|
|
|
|
hehe! nice one! very succinct!
Jammer
Going where everyone here has gone before!
|
|
|
|
|
From your example, it looks like you've got the concept of a switch statement a bit backwards. The syntax is
switch (boolean expression)
{
case [expression result 1]:
break;
} That being said, the switch can't take two values like you have but it can take any expression that returns a boolean. For what you are trying to do, it would be easier to just use an if/else block.
When comparing strings you should also be careful about comparisons using the == operator as it may not always return the result you expect on all platforms/languages. It's better to use the comparison functions in the string class itself.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Scott Dorman wrote: The syntax is
switch (boolean expression)
A switch can be done on pretty much any value type, even strings.
Cheers,
Vikram.
Zeppelin's law: In any Soapbox discussion involving Stan Shannon, the probability of the term "leftist" or "Marxist" appearing approaches 1 monotonically.
Harris' addendum: I think you meant "monotonously".
Martin's second addendum: Jeffersonian... I think that should at least get a mention.
|
|
|
|
|
Vikram A Punathambekar wrote: A switch can be done on pretty much any value type, even strings.
That is true, but it can't be on multiple values as was shown in the original example. I should have written the syntax this way:
switch (expression)
{
case [expression result 1]:
break;
}
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
modified on Tuesday, March 11, 2008 3:40 PM
|
|
|
|
|
Indeed ... I'm still thinking in FoxPro fashion when it comes to things like this.
Jammer
Going where everyone here has gone before!
|
|
|
|
|
switch (string1 == string2)
{
case true:
return string1;
case false:
return string2;
default:
return string3;
}
You could also use the string.CompareTo(string) method
Dave
|
|
|
|
|
I hate to cross post, I already posted the question on the COM Message Board. It you have any experience in the above please read post. Title starts Component Services->COM+->Add new component hangs... THX
|
|
|
|
|
scottdj wrote: I hate to cross post,
So then don't. Seriously, it usually doesn't help your chances of getting a response. I'm including a link to your original post as well...
Original Post[^]
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|