|
In particular, look under System.Collections.Generic
Generics are not STL, but they end up having similarities.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
hello every one.
well my question is simply this
how to put the gradient effect on the BindingNavigator object's bacground in Windows Forms??
I've noticed that once I've changed the background color of a binding Navigator, it just shows u the color in a plain n simple way u know. and it doesnt look too good either, So plz help if u can,
thanks
Rocky
|
|
|
|
|
I'm having trouble understanding how to work with controls (RTBs for example) on TabPages which I've added to the application programmatically.
I have a C# Windows.Form app with a menustrip including std entries, a TabControl to which I'm adding TabPages and a StatusStrip. Simple stuff.
In the event handler for the "New" menu option, I create the new TabPage and add a control like a RichTextBox to it. Works fine so far.
When I try to access the RTB to do something like Copy or Paste by clicking on their menu options, I seem to lose the plot. I can't seem to get this to work. I suspect I've structured the program wrong but not sure how to resolve this. The app compiles but I get "out scope" types of messages when I run it and try to use menu options to access the controls on the TabPages. I'm using VS2005 BTW.
I've tried looking at many other code examples but they are either far to complex for me to easily work out the proper structure (SharpDev for example) or don't do what I'm trying to do so they don't apply to my situation. Some of them probably hold the answer but I'm just to thick to get it
Any help or advice would be greatly appreciated. Thanks
JimKeating
|
|
|
|
|
Hi,
first and for all there is no fundamental difference between Controls added by using the
Visual Studio Designer, and Controls added programmatically; after all the only thing
Designer does is adding code to yours, so you may want to have a look at how it translater
your interactions into real code.
Second, the trick is in keeping a reference to the Controls you create:
class XXX {
void addALabel() {
Label label1=new Label();
label1.Text="unaccessible";
this.Controls.Add(label1);
}
private Label label2;
void addAnotherLabel() {
label2=new Label();
label2.Text="good";
this.Controls.Add(label2);
}
void changeALabel() {
label2.Text="new text";
}
}
In the above example, label1 is created, added to the form, it will be visible, but
you can not (at least not easoly) change it anymore, since the variable "label1" indeed
is "out of scope" as soon as the {} brackets around it get closed.
On the other hand, label2 is available (as long as its surrounding brackets dont close).
So the changeALabel() method can change its text.
The same applies to all kinds of Controls, in no matter how complex your form gets.
Hope this helps.
Luc Pattyn
|
|
|
|
|
Luc,
Thanks for the reply. I understand your example. Your explaination should put me on the right track. Now I just need to translate your explanationand example into my own code and I should be on my way.
Thanks for the help.
Jim
|
|
|
|
|
I have 3 dlls involved in this. One is a 3rd party enhanced messagebox class. The second is several shared gui components that includes a wrapper to the 3rd party lib (I want to keep the wrapper separate to make updating the lib as easy as possible). The third consists of primarily nonGUI components. A few of those components do however spit out messageboxes in certain error conditions. The shared GUI components dll extensively references the shared nonGUI dll, so that dependency isn't changable. The problem is that when I try to have the nonGUI dll reference the GUIdll, which I only need for the messagebox wrapper, VS won't allow me to do so because it would create a circular dependency.
Am I correct in thinking my only options are to move the messagebox wrapper out of the shared GUI dll so that I can reference its new location from both, or to modify the classes in the nonGUI dll so that they let all their problem reports float up to a higher level before informing the user?
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
As I understand it, the logical dependency chain mainly is
GUIstuff --> nonGUIstuff --> SpecialMessageBox
I see three possible approaches to avoid the circular reference:
1) move the wrapper for SpecialMessageBox from GUIstuff to nonGUIstuff
you may feel it does not really belong there, and I would concur
2) move the wrapper to a separate DLL
GUIstuff --> nonGUIstuff --> wrapper --> SpecialMessageBox
it seems to be a pitty having a DLL for just that purpose
3) break the direct connection between your nonGUIstuff and the SpecialMessageBox;
this is the real OO approach: if the nonGUIstuff is about calculation, database accesses,
whatever, then it should not know how to interact with the user.
At best create an interface for reporting problems, implement it in GUIstuff,
and pass an object that implements it to nonGUIstuff.
Since you are going to ask anyway, yes, that interface itself belongs in nonGUIstuff
because nothing says it will use the GUI, and because nonGUIstuff needs it.
Hope this helps.
Luc Pattyn
|
|
|
|
|
Luc Pattyn wrote: As I understand it, the logical dependency chain mainly is
GUIstuff --> nonGUIstuff --> SpecialMessageBox
No, the main dependency is as follows.
GUIstuff --> nonGUIstuff
\--> SpecialMessageBox
There're only a very small number of dependencies between nonGUIstuff and SpecialMessageBox. GUIstuff is mostly controls shared between the mainApp.exe, and the newModule I've added for the current cycle. Most of GUIstuff and nonGUIstuff were originally part of mainApp but were pulled out to leave making newModule into a standalone app at some point in the future a simple task. SpecialMessageBox was a new addition and I didn't realize the problem until now because the places in question were oversites when it was initially added.
An interface like you suggested is probably the best option since some of the enhancements would produce feedback that would hardpressed to fit into a messageBox.
Making the change shouldn't be too painful since I'm the only developer, the downside is that I don't have enough experience to always come up with the best design decisions when i have to make them.
Thanks.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
You're welcome.
dan neely wrote: the downside is that I don't have enough experience to always come up with the best design decisions when i have to make them.
Well, as long as you feel when some advise could be helpfull, this forum and a
few million people are here to help.
Luc Pattyn
|
|
|
|
|
Calling by the other way:
Is it possible to call a stored procedure WITH PARAM from .net WITHOUT using "AddParams" ? I mean we should be able to call(exec) the SP just like we do in the query analyser. I'd construct the string like "sp_testproc '111','RR',23'". and execute it as nonQuery. Is there any way? please help.
*
|
|
|
|
|
Astricks wrote: 'd construct the string like "sp_testproc '111','RR',23'". and execute it as nonQuery. Is there any way? please help.
You could use an SqlCommand object and pass the SQL command string as "exec sp_testproc '111','RR',23'".
|
|
|
|
|
|
have a google for SQL Injection first.
Russ
|
|
|
|
|
Russell Jones wrote: have a google for SQL Injection first.
Thanks for adding that. I really should have included that in my original reply.
|
|
|
|
|
You could also stop cross posting.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi all,
I need you guys to solve this problem for me and I will really appreciate it.
I have 2 pages, pageA that receives two input from a text box and redirects when a button is clicked and sends the two parameters entered to PageB which uses it to search a database. below is my code:
Hyperlink.NavigateURL="pageB.aspx?num1=" +para1 && +"num2="+ para2
i don't know if it is the concatenations that is the problem.
I will appreciate it if I get a quick response.
AC
|
|
|
|
|
You might want to reword that to read "I really need help with this. I can't see the problem"
acodman wrote: Hyperlink.NavigateURL="pageB.aspx?num1=" +para1 && +"num2="+ para2
why do you have && and + ? You probably mean para1 + "&num2=" para2
|
|
|
|
|
Shouldnt that be
Hyperlink.NavigateURL="pageB.aspx?num1=" +para1+ "&num2=" + para2;
If in doubt, do it in multiple lines and watch at the intermediate values as in:
string s="pageB.aspx?num1=" +para1+ "&num2=" + para2;
Console.WriteLine("NavigateURL will be set to: "+s); // or whatever is able to show you a var
Hyperlink.NavigateURL=s;
Luc Pattyn
|
|
|
|
|
acodman wrote: I have 2 pages, pageA that receives two input from a text box and redirects when a button is clicked and sends the two parameters entered to PageB which uses it to search a database. below is my code:
Hyperlink.NavigateURL="pageB.aspx?num1=" +para1 && +"num2="+ para2
Try,
Hyperlink.NavigateURL = String.Format("pageB.aspx?num1={0}&num2={1}", para1, para2);
|
|
|
|
|
Hello guys .
i am developing an application protocol like soap
it is based heavily on xml ,
i need to read a string which contains the xml declaration of the protocol and manipulate that string using built in classes of xml in dotnet studio , can i initialize a class or any method with the string that contains the xml format..
Thanks guys.
Human knowledge belongs to the world.
|
|
|
|
|
|
Hello guys i just testing regular expressions
and i give to the regex class a well formatted pattern
but it always unable to recognize the string whereas i put validated string that contains the regular pattern .
here is my code
<br />
using System.Text.RegularExpression;<br />
.<br />
.<br />
.<br />
.<br />
.<br />
string pattern = "([0-9]+\".\"[0-9]*)";<br />
Regex reg = new Regex(pattern);<br />
if((reg.Match(inputText.Text)).Success)<br />
{<br />
OutputText.Text = "Matched successfully";<br />
}else<br />
{<br />
}<br />
it always enters in the else block in the code whereas the pattern is well formatted and in good structure. is that it ?????
please tell me cause i need to kill my compiler.
Human knowledge belongs to the world.
|
|
|
|
|
the pattern doesn't work at all. Why are you trying to place quotes in the pattern?
([0-9]+\.[0-9]+)
|
|
|
|
|
Thank you ed , Really thank you brother. i had figured that out , thank you
Human knowledge belongs to the world.
|
|
|
|
|
I have Created one Class Libary(DLL) Using C#.net 2005 .
How to use that Dll in C-Lang or C++ (Using LoadLibary).
How to call those functions from C or C++ (6.0 version)
Thanks in Advance
Regards
Vijay
|
|
|
|