|
Lets imagine I have form FormA which has 1 button on it and I created it using VS.NET by dragging and dropping. Now I want to create another form FormB which will have a 2nd button on it. I want FormB to inherit form FormA--simple enough. But in order for me to add the 2nd button to FormB, I would have to do it programmatically, correct? In other words, I can not really drag and drop a 2nd button onto FormB.
The reason I am asking is because we often need to include a few extra controls to a form for specialization but when we do this, we lose design time flexibility.
If you have any suggestions, or if there is a design pattern which comes in handy in this situation, please let me know.
|
|
|
|
|
Create a new form and then in the designer have it declared as:
class FormB : Form A
{
FormB():
FormA()
{
}
}
This should allow design time support in the forms designer.
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
I will try that. Are you suggesting I will be able to see the 2nd form at design time?
When I tell girls I am studying Software Engineering, they respond by saying "Oh wow! What is that?" Then I tell them it is creating artificial intelligence (which is just one branch, but who cares!). This really impresses them.
|
|
|
|
|
Yeah the second form should render in the form viewer with all the components of the form it inherits from.
Hmmmm think I must live in an area with the wrong type of girls!!!
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Hi.
I'm using .Net 3.5, C#, CryptoStream with DESCryptoServiceProvider.
I've got an interesting problem. When i try to decrypt some message or file, i need to somehow detect if the key, that i pass to the CryptoStream, is valid (actually, i need to detect if the key is invalid). How can i manage this?
I tried to catch CryptographicException, but it causes lot's of problem..
thanks
|
|
|
|
|
Member 4083157 wrote: I tried to catch CryptographicException, but it causes lot's of problem..
Such as?? Because that's about the only method you have for detecting an invalid key.
|
|
|
|
|
The main problem is that CryptographicException do not throws on some invalid keys. i tried to check them with DES.IsWeakKey and DES.IsSemiWeakKey, but result is always false..
Then, to catch a CryptographicException i need to wait the whole cycle of decryption and it takes some time, and the programm's task is to find the right key in some range of keys. Of course, i use distributed search, but this problem is still actual..
Is there any way to use hash of the encrypted and decrypted data?
|
|
|
|
|
Member 4083157 wrote: Is there any way to use hash of the encrypted and decrypted data?
That would defeat the purpose of encryption pretty quickly now, wouldn't it?? You simply don't have a way around this. There are only three possiblities here.
1. The key is blatantly invalid, such as incorrect length or tampered with.
2. The key is just the wrong key, in which case, the only way to tell is to try and decrypt a message with it.
3. The key is correct.
There's no way to predict in a quick fashion if the key is correct or not. It just has to be tried to find out. That takes time, and there's no way around it.
|
|
|
|
|
|
Why can't you compare it to the key used during encryption?
|
|
|
|
|
Because i don't have such key..
|
|
|
|
|
If you're trying to get hints on how to break the key or encryption, forget it. We're in the business.
|
|
|
|
|
I installed .Net framework 3.0 but not getting the templates of WCF WPF etc. What extra configuration is to be done for that.
Bijay Bhaskar Deo
Thanks & Regard
|
|
|
|
|
Did you install the SDK version of .NET 3.0 or the redistributable version?? Where did you get it from??
|
|
|
|
|
I have a form which has layout like this:
form
|--->usercontrol1
|----->usercontrol2
|---->combobox1
|---->combobox2
What I want to do is when selected item of comboxes changes, unfocus them. I tried this.ActiveControl=null, Findform().usercontrol1.ActiveControl = null, FindForm().usercontrol1.Focus(), FindForm().Focus() etc. on selectedindexchanged event but that comboboxes always stayed focused.
Any other ideas?
|
|
|
|
|
Where do you want to throw the focus after selection has changed?
Also, pay attention to combo box as it has SelectedText (or something like it), so you probably have to deselect that as well. Just a guess.
|
|
|
|
|
I'd like to make usercontrol1 focused.
I'll check SelectedText.
|
|
|
|
|
UserControl's cannot have the focus, however, one of it's child controls can.
|
|
|
|
|
Ok let's forget usercontrol. Do I have to set focus elsewhere to unfocus combobox? If yes how can I focus the form?
|
|
|
|
|
kensai wrote: Do I have to set focus elsewhere to unfocus combobox?
Yes, some control has to have the focus.
kensai wrote: If yes how can I focus the form?
You can't. You have to focus some other control on the form.
|
|
|
|
|
Hello all. I have a couple of questions regarding assemblies.
Can an assembly contain other assemblies?
Can an assembly directly contain types?
Any help would be appreciated. Thanks.
"If you don't know where you're going, you'll probably end up somewhere else." Yogi Berra
|
|
|
|
|
Your question has been already answered in c# forum.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I created a DLL file in c# 2.0 . After some days i make some change in (opened in 2.0 again) dll and compiled it. may i know it will be creating new version or will be previous version .
Thanks
Sujit
|
|
|
|
|
Check AssemblyInfo and compare them.
|
|
|
|
|
Hiii...
I am receiving this error :--->
Server encountered an internal error. For more information, turn on customErrors in the server's .config file.
Server stack trace:
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
1) After googling, I found that customErrors mode="off can help.
Presently its True on Server side. Like this
RemotingConfiguration.CustomErrorsEnabled(true);
2) I am using .Net 1.1 on the server side and .Net 2.0 on client side.
3) Not getting this problem frequently. It has only 5% chances.
4) When I debugging found some interesting stuff:
class One
{
public string m_sResult = null;
public string GetInfo(string sID)
{
try
{
if(OnRequested != null)
OnRequested(sID);
return m_sResult;
}
catch(Exception ex)
{
WriteLog(“ “);
}
}
}
class Two{
void OnRequestedHandler(string sID)
{
try
{
One.m_sReult = "Done";
}
catch(Exception ex)
{
One.m_sReult = ex.message;
}
}
}
From the client side, I am calling One.GetInfo() method.
a) Event OnRequested(sID) raised and handled by class Two and One.m_sReult is set as "Done".
b) But on client side it returns NULL and also writes Log "Server encountered and internal....." on Server side.
So suggest me, what I should do to solve this problem.
I should use customErrors mode="off for better understanding?
I would appreciate any help or suggestions that anyone can provide.
Thank you.
Sidh
|
|
|
|