|
Hi,
I'm having a user control in .Net 2.0 created with Visual Studio 2005. Where would you place cleanup code? I ask because the partial file of the designer contains the Dispose method where I normally placed my cleanup code. But generally I'm trying to avoid to manually change the code of the Designer.cs files.
What are the common practices concerning this?
Robert
|
|
|
|
|
Hi,
When a form is disposed, all child controls are disposed. So you have hust to dispose the form.
HTH.
|
|
|
|
|
You can use the Disposed event to add an event handler that will be called when the controls is being disposed.
---
single minded; short sighted; long gone;
|
|
|
|
|
Good point. Should have thought of this myself. Although I normally try to override base functions instead of binding events in the user control/form itself this sound good in this particular case where the Dispose method is already overriden in the Designer code.
Thanks.
Robert
|
|
|
|
|
Hi friends, I am developing Shopping cart in ASP.NET. Whenever I am entering username and password in ASP.NET Login Control, the problem with focus is occured. I want to Login the user without requiring user to click LOGIN button....means whenever the user enters the username and password, and If he do enter, he should be Login.
Chintan Mistry
|
|
|
|
|
Try using cookies to store the login detail after first login. Search google as there are millions of example of ASP.NET cookies to store credential details.
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture)
http:\\www.frankkerrigan.com
|
|
|
|
|
I have a ListView in details view. I need the item to be in a different position than the default one so I have written de code for DrawItem event. The items show in the correct position but when I select one and move to another one the control doesn't refresh its contents very well.
This is the code in the DrawItem event
Rectangle r = e.Item.Bounds;<br />
<br />
int charIndex = this.richIzquierda.GetFirstCharIndexFromLine(Convert.ToInt32(e.Item.Tag));<br />
<br />
r.Y = this.richIzquierda.GetPositionFromCharIndex(charIndex).Y;<br />
<br />
if (e.Item.Selected)<br />
{<br />
e.Graphics.FillRectangle(Brushes.Blue, r);<br />
e.Graphics.DrawString(e.Item.Text, e.Item.Font, new SolidBrush(Color.White), r);<br />
e.DrawFocusRectangle();<br />
}<br />
else<br />
{<br />
e.Graphics.DrawString(e.Item.Text, e.Item.Font, new SolidBrush((sender as ListView).ForeColor), r);<br />
}
This is the control shown on screen Link
How can I fix this problem? Thanks
|
|
|
|
|
Hello,
I am currently developing a DVD Playback Windows Application using C#. I am using the "IDvdInfo2.GetCurrentLocation Method " to get the current location of Playback.
I have an option in the windows application which allows the user to go throu the DVD one step at the time. The following the code for this.
private void stepForwardToolStripMenuItem_Click(object sender, EventArgs e)<br />
{<br />
int hr;<br />
DvdPlayLocation theVariable;<br />
<br />
playState = PlayState.Paused;<br />
hr = videoStep.Step(1, null);<br />
dvdInfo.GetCurrentLocation(out theVariable);<br />
txtlogDvd.AppendText("bFrames : " + theVariable.timeCode.bFrames + "\r\n" +<br />
"bHours : " + theVariable.timeCode.bHours + "\r\n" +<br />
"bMinutes: " + theVariable.timeCode.bMinutes + "\r\n" +<br />
"bSeconds: " + theVariable.timeCode.bSeconds); <br />
}
Unfortunatly, the display value for the frame "bFrames" is only updated every 14 steps (Frames)!!! Therefore my famre number is wrong most of the time, expect the time it gets updated which is every 14 frames. Can someone be kind enough to tell me what is going on?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
Why can't we use the protected / private modifiers on interface signatures?
company, work and everything else @ netis
|
|
|
|
|
Well, private would be pointless because the only thing that can access private members is the thing that declared it. Since an interface has no functionality what would you declare to be private that could be accessed?
You could use a similar argument for protected. The only thing that would be able to use a protected member would be things derived from the interface only. In that case, what would be the advantage?
|
|
|
|
|
For protected method signatures the advantage would be to not to expose the method to outside.
Check out this link[^] that discusess something similar.
company, work and everything else @ netis
|
|
|
|
|
Zoltan Balazs wrote: Check out this link[^] that discusess something similar.
They are not really private. The are publicly accessible when the object is cast to the appropriate interface. It is a mechanism to allow the disambiguation that may be needed if you inherit two different interfaces that happen to define the same member signature.
Zoltan Balazs wrote: For protected method signatures the advantage would be to not to expose the method to outside
But why would you need this on an interface? I can see this being useful on an abstract class (defining an abstract protected method) because the abstract class can contain some functionality and may wish to call the protected abstract method. The method details will be implemented in the derived class. But an interface contains no functionality, only member signatures. So it can have no advantages.
|
|
|
|
|
Colin Angus Mackay wrote: he method details will be implemented in the derived class. But an interface contains no functionality, only member signatures. So it can have no advantages.
As I see it:
- I would have an interface that defines signatures of required protected methods
- these protected methods will be implemented in all similar classes
- the functionality will be similar to abstract class with the advantage that the designer could work!
That is what pisses me... that when deriving from an abstract class that suits my needs I can't use the designer later on (because it derives from a class that can't be instanciated)!
company, work and everything else @ netis
|
|
|
|
|
Because the purpose of an interface is to specify members that a publically available to any code that uses a class that implements the interface.
There is no reason to force a class to implement anything for an interface that can't be used from the interface anyway.
---
single minded; short sighted; long gone;
|
|
|
|
|
That was much better worded than my explanation - and more succinct too.
|
|
|
|
|
Absolutely and it was a stupid question from me
Actually what I had in mind was to use abstract class to require implementation of some methods
in a a derived form, but the the designer complains about how an abstract form can't be instantiated.
As a result the derived (non-abstract) form does not show up in the designer.
And that's why I thought of interfaces.
company, work and everything else @ netis
|
|
|
|
|
Hi all,
Greetings.I need to detect the pop up bloker using javascript. if Pop is turned on i've to display a message "POPUP ON", if it is off have to display "POPUP OFF". I've tried out with some coding from net. But it is not working. Can any one of you help me to solve this issue as soon as possible. Its urgent.
Thanks in advance.
Babu
|
|
|
|
|
This is a C# forum, not JavaScript forum.
Try searching it in google...
|
|
|
|
|
hi! i want to create the following textboxes..
please help me..
1.one textbox contains numeric values only.
2.one contains characters only.
3.one contains EmailId.
4.one contains phone no
5.one contains pincode.
6.one contains fax no.
7. one contains mobile no.
8. one contains fax no.
how to validate this?
|
|
|
|
|
use pattern matching for this.if you want to validate your input at the time of keypress then you have to do a little extra work on textBox_KeyPress event
else apply your validation at the time when you control looses its focus
|
|
|
|
|
Check if this helps u,
Following code snippet is an example for validation of textbox. similar way compare values with different ascii numbers i.e. for only characters, numeric values...etc..
//VALIDATION FOR TELEPHONE NUMBER
bool valid5 = false;
char[] name5=new char[20];
name5=textBox27.Text.ToCharArray();
int leng5=textBox27.Text.Length ;
for(int i=0 ; i < leng5 ; i++ )
{
if( ((Convert.ToInt32(name5[i])>='0')&&(Convert.ToInt32(name5[i])<='9'))||(Convert.ToInt32(name21[i])==32))
{
valid5=true;
}
else
{
MessageBox.Show("TELEPHONE NUMBER: Enter the valid Telephone Number");
textBox27.Focus();
return;
}
}
|
|
|
|
|
Use a Validator with regular expression. there are lots of examples on the web.
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture)
http:\\www.frankkerrigan.com
|
|
|
|
|
I would like to check if user has entered ALT+10 or à , ä (UMALUT) or any english alphabets
The code sample in previous thread by 'sharmit' did not work for me.
Can you please point me the websites where I can find code sample for the same.
Sandeep Naik
|
|
|
|
|
I want to basically check if user has entered any control characters
like 1-32 or 127 ASCII value (Ex: ALT + 127) in the edit box. And discard the same.
FYI this edit box should allow any other non english characters like French, German, Chinese, Japanese etc
Sandeep Naik
|
|
|
|
|
Hello
I am trying to DoubleClick a row in a datagridview and open new form
and have textboxes populated from selectedrow.
This opens new form, not sure if its catching data
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
MasterForm.ActivateTab(2);
string strTemp = "";
strTemp = dataGridView1[dataGridView1.CurrentCell.RowIndex, 0].Value.ToString();
}
How do I bind it on next page/form to populate textboxes for selected columns?
Many thanks in advance
-- modified at 2:00 Friday 2nd March, 2007
|
|
|
|