|
Hi there,
I hava a Form with 2 UserControls and 1 dialogBox. I want to use the DialogBox to set which UserControl will display on the Form.
-UserControlA(a button: buttonToB)
Form -UserControlB(a button: buttonToA)
-DialogBox(2 buttons: Ok & Cancel)
The Form will display UserControlA as StartUp, when buttonToB is clicked, the DialogBox appears, if Ok is pressed, then UserControlA will be removed and UserControlB will be add to the Form.
I have public menthods in the Form as follows:
public void RemoveUserControlA(){
this.Controls.Remove(UserControlA) // remove B
UserControlA.Dispose();
}
public void AddUserControlB(){
this.Controls.Add(UserControlB)
}
In the UserControlA, when the buttonToB is clicked
private void buttonToB_click(){
if(dialog.Result == Ok){
Form f = new Form();
f.RemoveUserContorlA();
f.AddUserControlB();
}
}
Questions
1) How can I have some methods in the Form, and then invoke it in the UserContolA (i.e. public methods ?)?
2) How can I remove the Usercontrols using the dialog?
thanks.
|
|
|
|
|
hi all
how can i read image into byte array and then store that image into Access DB
thank you ,
|
|
|
|
|
ok i found an answer of the first part of thte question that was
"How can i store image into byte array"
But What about the second Part
i know that i should use OlE object data type to image into it ...
"How can i store that byte array into Access DB?"
"How the query will be?"
|
|
|
|
|
This question has been asked several times, you should try searching the forums before posting a question, especially one that is so common.
Search results[^]
This[^] post might help.
Remember, most of the questions have already been answered, try searching the forums first, you'll get a quicker answer.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hello evrybody,
I need sample code in C# which open serial communication COM1 in .NET COMPACT FRAME.
Thanks for your helping.
|
|
|
|
|
Is there no (free) way to play MP3s in c#, without requiring that the user download lame.exe? I don't need to do anything fancy like getting ID3 tags or anything, I just need to play back MP3s - smoothly looping them.
thanks!
- invid
|
|
|
|
|
you can use MicrosoftMediaPlayer which is COM Object in .Net
|
|
|
|
|
Hello
is it possible to detect Installation Folder?what i want to create in my Application`s Folder only which normally is created in Program Files folder..
kindly guide me
-adnan
|
|
|
|
|
Is Application.ExecutablePath what you're looking for?
mav
|
|
|
|
|
Hi Guys,
I have a bit of code like this;
Code1:
Console.WriteLine(Int16.MaxValue);
O/P: 32768
Code 2:
string s="Int16.MaxValue";
Console.WriteLine(----------------);//using string s
O/P:
Should be 32768
Plz can u tell me how to Code1 o/p in Code 2:
In action script we use eval() keyword which produce required o/p
I am looking for ur reply.
Thanks,
Senthil Kumar Ramachandran.
|
|
|
|
|
Hello i have a problem i hoping someone might
be able to help with Using the registry in C# ?
I have found all kinds of sample code on the net
and have gotten it to work fine, but..
I am trying to make a small program for myself
to help add some of my registry changes
that i always do when i re-install windows..
So far i have been able to get/retrieve all kinds
of keys and it all works fine basicly, until
i come to one registry change i am trying,
and that is i want My Windows XP to "Auto Logon"
with out having to use a .reg file (what i used to do)
The problem is C# creates the wrong type of key
when i create a null entry.. here is what i mean..
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
RegistryKey OurKey = Registry.LocalMachine;
OurKey = OurKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true );
OurKey.SetValue("AutoAdminLogon","1");
OurKey.SetValue("DefaultPassword","");
OurKey.Close();
}
You see when this code is executed it creates
thge DEFAULT "key type" for Reg_Sz which actualy
is not the same as having a normal blank key.
Look at the registry section mentioned in the code
for either, LegalNoticeText or System,
right click the key and select "modify binary data"
it will look diff than the key at the top that says (Default).
So to make this clear i want to create a blank key (string) Reg_Sz named = DefaultPassword
BUT not a Default Reg_Sz key..
So i had done all this waaaay easier before with C++
and now i have to say i am a little disapointed with
how crappy the C# registry functions are !
So can anyone out there help me out with this ?
also this is the page on MSDN that mentions the C# code.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfmicrosoftwin32registrykeyclasstopic.asp[^]
Edit:
well i decided to just create a .reg file
and execute that from my program with this line,
System.Diagnostics.Process.Start(@"XP-AutoAdminLogon.reg");
that works ok.. but its too bad i cant find a way
to create a proper blank string value in C#
(with out it beeing a normal default type)
|
|
|
|
|
xpmule wrote:
and now i have to say i am a little disapointed with
how crappy the C# registry functions are !
Had you read the note under the members topic for SetValue, you would have seen that the type of key created is deterimined from the way you pass in the value data. You passed in an explicit empty string, so you get an sz_string valued key containing the empty string you asked for.
Try passing in a zero length byte array or a null object... And RTM before you complain.
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
Well first off i was trying to keep my post short.
I have tried many thing everyday for almost a week
and all results were a failure..
Windows will only recognise one type of key
for autoadmin logon to work and when passing
a "null" value, the default key type is created
which if ya check what i was saying earlier
that it has a diff binary value and in turn
windows will reject the key and ask for the password.
So the easy answer would be for me to set
a password, not leave it blank.
but i don't want to do that though.
oh and the passing an array idea
produced the wrong type of key.. REG_MULTI_SZ
and like i was saying that won't work
(for windows auto logon to function)
and here is the code i used..
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
RegistryKey OurKey = Registry.LocalMachine;
OurKey = OurKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true );
string[] strMyArray;
strMyArray = new string[0];
OurKey.SetValue("AutoAdminLogon","1");
OurKey.SetValue("DefaultPassword",strMyArray);
}
So im thinking I found a limitation in the C# Reg Class
that wasn't a problem in the least when
i used c++ before to make the same program.
And if anyone can help me get the desired result ?
That would be great and I thank you kindly in advance !
Oh and to make this perfectly clear !
I didn't make this post to "complain" about C#
Rather to ask for some help..
I am really new to C# and am enjoying learning
all this and have found a way around my problem for now.
And i didn't mean to poop on C#
it has amazed me a lot already in how
easy it is to learn and use.
|
|
|
|
|
hi all ,
how can i detect that my application is running from CD-Rom Drive and not from HD
thank you
|
|
|
|
|
use
Environment.CurrentDirectory
to get the current directory of your application and check it yourself
|
|
|
|
|
Better than the current directory (suggested in the other post) use Application.StartupPath . It will always contain the folder where the EXE is located, even if the application changes the current directory (possible and more or less common.)
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
after drawing an ellipse on the form i want that if anyone clicks on the ellipse, it's properties should be displayed in a message box.
anyone with any one pls do mail me.
thanx a lot
Er.Tushar@gmail.com
|
|
|
|
|
hi there,
HW I guess (If not, my apologize)
just few hints look at Region and GraphicsPath classes.
I think it should be easy...
MSDN[^]
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hi, i want to send mouse click like "SendKeys", can I do it with shell or what should I use for it?
|
|
|
|
|
Can anyone point me to any opensource C# finite automations software or something that can be related to finite automations theory? Any link on this subject is greatly appriciated.
Thanks in advance!
|
|
|
|
|
|
Hate to disapoint you but I already saw and read that...
Thanks anyway
|
|
|
|
|
Hi,
I have created a user login screen for an application. What i want to achieve is the focus of the login button so that when a user hits the enter key the button is triggered that will process the user name and password.
Thanks for any help.
Regards,
Stephen McAllister
|
|
|
|
|
form1.AcceptButton = your_button.
Process the user name and password from the your_button click event.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Now i am doing dragdrop with my usercontrols, such as button. I got these
two; CF_XMLCODE dataformat and
Microsoft.VisualStudio.Designer.Serlization.DesignerSerializationObject
datatype from the e argument of the dragdrop event. However I can't find any
reference about these two. What are they ? How can i use these to retrieve
all data and recreate my draging usercontrol ?
Thank you
|
|
|
|