|
I'm not using the attributes to define metadata, or at least I don't think I am.
I give a method an attribute (e.g. [PostUpdate]), in the update process I look for methods with that attribute, if the parameters are the ones I provide then invoke the method - no adding methods to events, no OnBlahBlah methods - obviously not as granular as events (unless you prepared to have lots of attributes)
I thought refactoring was onselling the debts you bought at a discount
rgds phild
|
|
|
|
|
Guys I'm running out of ideas, I want to program something smart and creative so I can further advance my sqls
So far I did programs like:
Multi tab web browser (around web browser control)
Mulit tab editor (rich text box, xml, etc)... by far best thing I did 1200 lines of code in this one
Calculator (like standard win calc)
Some picture viewers both MDI and simple...
Some phone book program...
Student evidential program (take care about student data, massive use of inheritance, abstract methods, arrays, printing, etc).
Quad Media Player... can open 4 media files at once in one form... nice for comparing edited and unedited material...
Fahrenheit-Celsius converter with events...
and lot's of small things...
Now I want to do something on next level...
I don't want to involve much math in it... some level is fine... I want program to be usefull for something I do every day (or at least it's something someone would like to use every day)?
Any idea is welcome?;P
|
|
|
|
|
if you program every day, why not write something to help you do that.
I could do with something that generates UIEditors for complex objects eg
Dictionary<Guid, Dictionary<string, LinkedList<T>>> etc
that way you'll learn how to cope with restrictions imposed by existing infrastructure in this case the IDE.
|
|
|
|
|
Want to help me with this?[^]? It definitely qualifies as "something on the next level".
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
|
|
|
|
|
Marc Clifton wrote: qualifies as "something on the next level"
Sound interesting but it's way ahead of one level up, I'm only doing c# for 2 months now... so maybe later who knows...
I guess I'll just stick with ADO.NET 2.0 for now... that is next thing I need to learn good I guess...
Still good ideas are welcome...
|
|
|
|
|
Lets say you have two text boxes, and you want to update one any time the other changes, regardless of which changes.
For example converting between Miles and Km.
How do you prevent the endless loop?
David Wilkes
|
|
|
|
|
Remove the event handler that listens for changes of the other textbox before you change its value and readd it afterwards.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
The XXXchanged events only fire when the value really changes, assigning a value that is
not different from the current value does not fire the event.
So it all boils down to the question: is my calculation numerically stable, i.e. will
it converge to a single value.
If yes (as with linear transformations, e.g. your unit conversions), dont do anything special.
If no (or unknown), break the loop explicitly (e.g. by removing and reinstalling one of
the event handlers).
The following example has two TextBoxes, showing a number and its square; for some of the
values (e.g. 50) it will take two iterations, but it always reaches a stable result:
public class CPTest_ChangedEvent: CPTest {
TextBox tb1=new TextBox();
TextBox tb2=new TextBox();
System.Windows.Forms.Timer timer=new System.Windows.Forms.Timer();
public override void Run() {
tb1.Text="1";
tb2.Text="1";
tb1.TextChanged+=new EventHandler(tb1_TextChanged);
tb2.TextChanged+=new EventHandler(tb2_TextChanged);
timer.Interval=1000;
timer.Tick+=new EventHandler(timer_Tick);
timer.Start();
}
private void tb1_TextChanged(object sender, EventArgs e) {
string s=tb1.Text;
log("tb1_TextChanged: "+s);
double i1=double.Parse(s);
double i2=i1*i1;
tb2.Text=i2.ToString();
}
private void tb2_TextChanged(object sender, EventArgs e) {
string s=tb2.Text;
log("tb2_TextChanged: "+s);
double i2=double.Parse(s);
double i1=Math.Sqrt(i2);
tb1.Text=i1.ToString();
}
private void timer_Tick(object sender, EventArgs e) {
string s=tb2.Text;
double i2=double.Parse(s)+1;
tb2.Text=i2.ToString();
if (i2>100) timer.Stop();
}
}
Luc Pattyn
|
|
|
|
|
or a flagging mechanism can be used here.
|
|
|
|
|
I had a similar problem while using a combo box and grid row updation.
Try using "SelectionChangeCommitted" event. This would be fired only when the control selection is changed explicitly by user.
|
|
|
|
|
Hi,
I have made a simple Windows Application in VS.Net C# which downloads the file from a FTP location.
Now, I want this application to run daily at 4:00 AM in the morning. What should be the solution to acheive this goal. Since its a very small code, so I can re-write the code if required.
Thanks in Advance,
Harjinder
|
|
|
|
|
You can do all sorts of things, like write it as a service, or just leave it running and set a timer which checks DateTime.Now and runs when your desired time has passed, then set a flag that resets after midnight.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi all,
i have the following problem then i use an timer
<br />
_timer = new System.Timers.Timer();<br />
_timer.Interval = 60000;<br />
_timer.Elapsed += new System.Timers.ElapsedEventHandler(StopRecording);<br />
_timer.Start();<br />
this calls the
<br />
public void StopRecording(object source, System.Timers.ElapsedEventArgs e)<br />
{<br />
this.m_FilterGraph.Stop();<br />
MessageBox.Show("FERTIG");<br />
}<br />
InvalidCastExecption does not handle by user code.
The Com-Objekt of Type "System.__ComObject" can not convert to interface "MVSmartControll.IMVSCFilterGraph2"
German full output:
Das COM-Objekt des Typs "System.__ComObject" kann nicht in den Schnittstellentyp "MVSmartControl.IMVSCFilterGraph2" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID "{3F7A5C55-B875-4ECE-BD28-843C3AE4628A}" aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE)).
if i call this.m_FilterGraph.Stop() manual all works fine.
any idea how i can fix this ? so i read that the timer create an threadpool.
greeting gigo
|
|
|
|
|
Could it relate to the state of the variable when the timer goes off ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
|
Set a breakpoint on the timer, and see what the variable looks like there. Perhaps set breakpoints where-ever you change the variable, to establish order of operation.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I assume your COM component does not stand being called from different threads; I am
guessing you start recording from the UI thread, and stop recording by the timer
elapsed event, which runs on a thread pool thread.
If this is correct, there are basically two ways to fix it:
1) use Invoke to get the stop done on the UI thread
2) recommended: use a Forms.Timer instead of a Timers.Timer (so the tick event
automatically runs on the UI thread)
Luc Pattyn
|
|
|
|
|
I have a frame control that is running an external XAML file that contains a page.
I want to pass some options from the window that is hosting the frame control to the page running in the frame, how I do this?
what I have tried:
I assigned a reference to the tag property of the window. and then in the page onload(), I've tried to access it by using this.parent.tag, but the parent seems to be null.
maybe there is a better way... can anyone help me?
btw, why not create a different message board for .net 3.0 stuff like WPF, WCF, ... ?
thanks in advance,
Niko
<< Nearly all men can stand adversity, but if you want to test a man's character, give him power. >>
|
|
|
|
|
hi all
i have a form that in shows som html using web browser activex.i want to write some code that search in html and hilight finded text. how i can do this
please help me
|
|
|
|
|
On a multiple monitor workspace,used as a disco ball I have a scrolling display.
The scrolling data is complex so I need to show a 'legend' on each physical monitor.
The scrolling display (WebBrowser with Marquee) is stretched across the VirtualScreen that is composed of 3 or more physical monitors.
Problem
How do I dynamically create a picturebox at runtime? Each picture box will contain an image (.png).
How do I place a common image on each physical monitor. I can calculate the position to put the image but am having trouble figuring out how to get the Picturebox to instantiate at run time
TIA
-- modified at 16:23 Tuesday 23rd January, 2007
-- modified at 16:41 Tuesday 23rd January, 2007
Tom Hamilton
|
|
|
|
|
You can add or remove a Control to a Form programmatically whenever you want;
it basically requires the same kind of code that the Visual Designer creates
when you interactively add a Control. So you could do:
void myButton_Click(object sender, EventArgs e) {
Label label=new Label();
label.Text="my button got clicked";
label.Location=new Point(x, y);
y+=30;
this.Controls.Add(label);
}
The main problem with this kind of code is in positioning the new Controls;
in the example, you need some initial x,y values, and each new Control will be
positioned below the previous one. In the end they are bound to fall of the form...
Luc Pattyn
|
|
|
|
|
Thank you Luc. By setting the Drawing point I can control the location of the control.
Tom Hamilton
|
|
|
|
|
Can i use multiple configuration files within a Windows or ASP.NET application? If yes then how? I tried it but application only reads configuration from a single file.
Thanks.
|
|
|
|
|
Yes you can.You can use the file attribute [^] of the appSettings to specify a relative path to an external file.
|
|
|
|
|
I am working on a C# .NET Winforms project, and I'm stuck on an obscure issue relating to COM and .NET. No one in the company I work at is particularly experienced in COM / .NET interop, and I've already spent too many hours searching books and internet sources for good information on the topic. I was hoping that some person with experience could shed some light on how I should proceed.
Here's the issue:
I am rewriting legacy code that was written in C and C++. The purpose of one piece of legacy code is to display all COM libraries in the registry and allow the user to select the name of the COM library they want and the name of the COM object (in that library) that they want. It then saves information about the COM object (library GUID, interface GUID, and class GUID) of this COM object into a database for further use.
It accomplishes this task by creating an ITypeLib object, which is used to open the library and extract the introspection data from the library. *(note: the COM "introspection" concept is known as "reflection" in .NET)
The System.Runtime.InteropServices.ComTypes namespace (in C#) has an ITypeLib interface (and other interfaces that I need), but I can find no example of anyone implementing this interface in a usable way, and if I knew how to implement that interface to extract the data I need, I wouldn't have a problem in the first place.
Using C#, I can already extract the COM library information I need from the registry (all the library GUID's, descriptions, and full paths), but after that I'm stuck, as I cannot read these libraries for their introspection data.
Does anyone have a clue as to what I need to do next? If so, thanks a lot in advance.
|
|
|
|