|
Good point. I like that. I'll would normally use a while loop when purely searching for an item (mainly because 'break' feels a bit messy), but I'll admit to using foreach sometimes. I won't do it any more. That's a dam good reason.
Thanks
Simon
|
|
|
|
|
Simon Stevens wrote: I'll would normally use a while loop when purely searching for an item (mainly because 'break' feels a bit messy),
Good man that man.
|
|
|
|
|
I think using foreach with a conditional break is fine, why do you think it is bad design, Simon?
regards,
George
|
|
|
|
|
George_George wrote: why do you think it is bad design,
It tends to be an indication of poorly thought out implementation. If you are using a break statement, then this means that you know what the end condition is for getting out is, and it's not a count based condition.
|
|
|
|
|
Thanks for your clarification, Pete!
regards,
George
|
|
|
|
|
Why do you think it is "conceptual distinction", PIEBALDconsult? Any more descriptions?
regards,
George
|
|
|
|
|
Why do you think "foreach is somewhat frowned upon", PIEBALDconsult?
regards,
George
|
|
|
|
|
Hi EveryOne,
I am writing a windows application that Refers a COM component which exposes a single function called Connect(). I have referenced COM Component but I don't know how to call this function on a button click.
In VB we create a variable and then set an instance of the class object to the varibale, finally browsing this variable with a dot operator would reveal the methods exposed by the class. How do we achieve the same in C#?
I am new to C# so kindly excuse me if this is very basic and I am wasting your valuable time. Thanks.
Regards,
LG.
lgatcodeproject
|
|
|
|
|
lgatcodeproject wrote: In VB we create a variable and then set an instance of the class object to the varibale, finally browsing this variable with a dot operator would reveal the methods exposed by the class. How do we achieve the same in C#?
The same works in C#. You use the New operator to create a new instance.
MyClass myObject = new MyClass();
myObject.SomeMethod();
If you want to do something on a button click, you just find the handler for the click event for the button, and put the code in their.
Post your code. Which bit are you having trouble with?
Simon
|
|
|
|
|
Hi Simon,
The COM component(named ActiveXRAP) I have referred in my project(ActiveXRAPLib) is displayed as namespace.
<br />
namespace RAPClient<br />
{<br />
public partial class Form1 : Form<br />
{<br />
string output;<br />
<br />
<br />
<br />
ActiveXRAPLib.RAPClientX objRAP;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
}<br />
<br />
private void bConnect_Click(object sender, EventArgs e)<br />
{<br />
<br />
}<br />
}<br />
}<br />
Regards,
LG.
lgatcodeproject
|
|
|
|
|
That looks all right to me. Sorry.
Is RAPClientX defiantly a type?
Simon
|
|
|
|
|
Are you missing a "using ActiveXWrapLib;" at the top of the class?
|
|
|
|
|
Hi,
I made a custom user control and set it's public property "ShowFiles". now this property can be seen as a property of my user control in property window. I want that this property should be a combobox and it should shows all the files which are currently in my "Resources" at design time. at design time I will choose one of these and use as a property of my user control.
Plz help...
thanx in advance...
|
|
|
|
|
|
Hi,
I want to return a trigger when new row is inserted or existing row is updated.
if a row is inserted ,i have to return a trigger to my application.Later it is executed by our application to push data into our local database.
It's urgent. can anyone help me for this?
thanks
sri
|
|
|
|
|
Why do you need your application to handle this? It seems like a bad idea. What if you write a second program that updates the data and forget about the trigger thing.
Write a database trigger for Insert and/or Update or write a Stored Procedure that updates or inserts the data and does whatever other things you want done at the same time.
|
|
|
|
|
Member 4008492 wrote: It's urgent
Of course it is. Triggers don't do that, they fire IN the DB.
Christian Graus
Please read this if you don't understand the answer I've given you
"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
Use the DB triggers (INSERT, UPDATE) in order to log the changes that occur on the table, then use that log todo what ever you want
|
|
|
|
|
Do a search on "SQL Server Notifications". Triggers fire in the database, and are not what you need here, but notifications might work for you.
|
|
|
|
|
Is it possible to force a TextBox to show it's input cursor even though it's not active?
|
|
|
|
|
I don't think it's a good idea, because that would be confusing! Why would you do anything like that?
And no I don't think it possible.
|
|
|
|
|
I want it because we're writing a custom autocomplete function. We show a popup list, but when the popup is shown it's not possible to see what part of the textbox is being edited.
|
|
|
|
|
After showing the popup list, return focus to the text box to allow the cursor to be displayed. Handle keypresses on the text box and when appropriate respond to them by navigating through the list.
Or
Implement your own custom text box class, inherited from the TextBox and handle the drawing of the cursor yourself.
The first option is defiantly the easier.
Simon
|
|
|
|
|
No. And yes, that does suck, and it would confuse your users if you could do it.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Well... If you read about my reason above, do you still think it will confuse my users? I think it will confuse my users not to have it.
|
|
|
|