|
Hi, I have a Windows Forms application that was working just fine. Then I moved 2 controls on the form a few pixels and changed the size of the form. After that I got the following errors:
error C2039: 'Dispose' : is not a member of 'System::ComponentModel::IContainer'
error C2039: 'CurrentThread' : is not a member of 'System::Threading::Thread'
and 2 more errors that were caused by the above. Does anyone have an idea how to fix this?
|
|
|
|
|
Cleaning the solution solved the problem.
|
|
|
|
|
Hi everyone.. does anyone have an idea how to add new properties to standard controls like textbox.
thanks.
Software Developer
|
|
|
|
|
Obviously, you need to derive a class from TextBox, and add your property and whatever you want it to do, to the derived class.
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 )
|
|
|
|
|
pseudocode
public class NewTextBox :System.Windows.Forms.Textbox
{
public property NewProperty as string
{
get{;}
set{;}
}
}
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
you could also use the Tag property or read about observer pattern..
|
|
|
|
|
Hi there,
Can you please help me with this problem.
I am trying to send my custom string to cacls command to set the permission on a file on my desktop. where the name is saved in a textfile, and loaded into a label named: SendThisTextToCaclsAsFilename
Here is a code snippet of what I have:
String^ customString = "/c echo y| cacls \"%HOMEDRIVE%\\Documents and Settings\\"%USERNAME%\\" + SendThisTextToCaclsAsFilename->Text + " /D Everyone";<br />
Process::Start("cmd.exe",customString);
Now the part that does not seem to work is this:
%USERNAME%\\" + SendThisTextToCaclsAsFilename->Text + " /D Everyone";
The /D Everyone is not part of the command, I think.
I can't see the error message that the command is showing, because obviously it only flashes when applying the permissions.
How can I make this work?
Thank You in advance!!
|
|
|
|
|
Johan13 wrote: "/c echo y| cacls \"%HOMEDRIVE%\\Documents and Settings\\"%USERNAME%\\"
Your command line would look like this:
cmd /c echo y| cacls "%HOMEDRIVE%\Documents and Settings"%USERNAME%\someText /D Everyone
There's a problem just before %USERNAME%. I think that line should look more like:
String^ customString = "/c echo y| cacls \"%HOMEDRIVE%\\Documents and Settings\\%USERNAME%\\" + SendThisTextToCaclsAsFilename->Text + "\" /D Everyone";
|
|
|
|
|
Great! Much Thanx, I'll give it a try!
|
|
|
|
|
How can I create a directory oon the current logged on user's desktop?
I have tried this with non luck!:
String^ FolderPath = "C:\\Documents and Settings\\%USERNAME%\\Desktop\\" + txtFolderName->Text; <br />
Directory::CreateDirectory(FolderPath);
And this:
String^ FolderPath = "C:\\Documents and Settings\ + Environment::UserName + \\Desktop\\" + txtFolderName->;Text;<br />
Directory::CreateDirectory(FolderPath);
Then I want to set deny permissions with .NET on that current logged on user directory I created above.
What namespaces is required for the .NET way? If possible!
Well this does'nt work:
String^ customString = "/c echo y| cacls \"%HOMEDRIVE%\\Documents and Settings\\%USERNAME%\\Desktop\\" + lblFolderName->Text + "\" /D Everyone";<br />
Process::Start("cmd.exe",customString);
And this also:
String^ customString = "/c echo y| cacls \"%HOMEDRIVE%\\Documents and Settings\\" + Environment::UserName + "\\Desktop\\" + lblFolderName->Text + "\" /D Everyone";<br />
Process::Start("cmd.exe",customString);
Much Thanx.
|
|
|
|
|
Why are you trying to deny permissions to Everyone on a folder that only the current logged in user can see anyway? The user wouldn't be able to see the contents of the folder, but there's nothing stopping that user from just going to the Security properties of it and resetting his own access permissions to it.
You're looking for the System.Security.AccessControl namespace (.NET 2.0 and above) to do this in your own code.
|
|
|
|
|
thanx, don't worry not trying to do it anymore. It was actually a silly thing to do.
btw. I have a policy the restrict the user access to security permissions.
|
|
|
|
|
|
Does anyone know if this is even possible?
|
|
|
|
|
I need to draw the sun path with respect to the given input(Latitude,Longitude,Altitude and Azimuth).Am using Directx 9 in my WinForms.How should i draw the sun path??Any help is appreciated..
Regards,
Priya
|
|
|
|
|
Why do you need DX ? That means you want it in 3D ?
Do you not know how to calculate the position, or not know how to draw 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 )
|
|
|
|
|
Hi,
I donno how to draw the sun path with the given input.Do i need to use any Directx tools or properties in .NET is enough?I dont have any idea of how to draw it.
|
|
|
|
|
Here's what I think you said.
I want to draw the path of the sun in a program. I have no idea about graphics programming, but I've heard of DirectX, so I figured if I posted here, someone would magically cause it all to make sense for me.
1 - DirectX is for drawing in 3D
2 - if you want to draw a static path, DirectX is overkill
3 - what do you mean ' the given input ' ?
You need to read up on the Graphics and Bitmap objects, then you need to get a handle on the maths you use to plot the path you want to draw.
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 )
|
|
|
|
|
I have a Winforms application where I have to Textboxes.
I only want one of them to have text at any given time. So, I added
a TextedChange event to each of these TextBoxes that empties the text
of TextBox that is not receiving text.
The problem is this. If TextBox1 has the text "UT" and I then enter text
into TextBox2. The text is correctly removed but the first press in TextBox2
is ignored so the user has to enter it in twice. Once to empty the text of the
other TextBox and then again to actually have it show up in the TextBox being
typed to.
private void VIN_CHANGED(object sender, EventArgs e)
{
tbPlate.Text = string.Empty;
}
private void PLATE_CHANGED(object sender, EventArgs e)
{
tbVin.Text = string.Empty;
}
Anyone know how to get around the first stroke getting ignored?
modified on Thursday, May 1, 2008 3:41 PM
|
|
|
|
|
They both go away, becaues when you empty the other textbox it fires that box's textChanged event thus clearing the second box...it works the second time because the box is already clear. You'll probably have to use a flag to show if you should change it..or put some logic in the event to check if that box has focus i.e.
<br />
private void textBox1_TextChanged (object sender, EventArgs e)<br />
{<br />
if (textBox1.Focused)<br />
{<br />
textBox2.Text = "";<br />
}<br />
}<br />
<br />
private void textBox2_TextChanged (object sender, EventArgs e)<br />
{<br />
if (textBox2.Focused)<br />
{<br />
textBox1.Text = "";<br />
}<br />
}<br />
this prevents the event from doing anything if its control isnt the one bieng typed in..oh i'm using .NET 3.5 i dont know when the Focused property was added...i've never had to use it before, but there should be something similar in each version.
Hope this helps..if you have any more questions feel free to ask.
|
|
|
|
|
Thanks, you hit the nail on the head. I didn't realize that there was a domino effect going on.
|
|
|
|
|
How can I call one event from within another? For example, say I have the two events, one for a button and one for a textbox.
private: System::Void Button_Click(System::Object^ sender, System::EventArgs^ e)
private: System::Void TextBox_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e)
In the button’s click event after processing something I wish to focus on text box and validate user input in textbox. I have tried the following:
private: System::Void Button_Click(System::Object^ sender, System::EventArgs^ e)
{ // Do something
if(TextBox->CanFocus == true)
{ TextBox->Focus();
}
TextBox_KeyPress();
}
It doesn’t work because I do not know what arguments to pass. Also after validating user input in KeyPress event I wish to return to Button_Click event. Can I do that by simply saying ‘return’ in KeyPress event? Thank you for all help.
|
|
|
|
|
Hi,
I don't have the complete answer, and my examples will be C#, but here it goes:
1.
you can call your own event handlers from anywhere you like, and provide real or dummy
arguments (if the handler does not use them, dummies would be sufficient), just look at
the handler's prototype and pass either null (=dummy), new MyEventArgs(...), or a real EventArg.
2.
However you are not really supposed to call event handlers directly; instead you should
cause events to happen. Some Controls have methods for this purpose, e.g.
Button.PerformClick().
3.
When the required method does not exist (e.g. typing to textbox) you could extract the core
of the KeyPress or KeyDown handler, put it in a new method, and call that at will, without
it requiring the object sender and the specialized EventArgs argument, using simple data
arguments instead (such as char theNewKeyChar).
|
|
|
|
|
ok i have a big problem here,,,,i iam complete new to vb and programing... and i have my first proyect to do on a windows Form...i am trying to learn by reading and testin ideas,,,,
well here we go!!
i gave this code i will like to make simple as posible...
i will like to have 2 textbox 1 for imput and the other for the anwser...
i have to imput some how 0 true 9 and A to Z (all Caps)with some characters allready asing to them...
i think the idea is keypress but then again i have no idea how to start on this one.....
Exp:
when i type on textbox 1
0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
it will show on txtbox2
Ï Î Í Ì Ë Ê É È Ç Æ ¾ ½ ¼ » º ¹ ¸ · ¶ µ ´ ³ ² ± ° ¯ ® - ¬ « ª © ¨ § ¦ ¥
it has to be exact the same sysmbols for letter and numbers like this....
Ï Î Í Ì Ë Ê É È Ç Æ
0 1 2 3 4 5 6 7 8 9
¾ ½ ¼ » º ¹ ¸ · ¶ µ ´ ³ ² ± ° ¯ ® - ¬ « ª © ¨ § ¦ ¥
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Please i will thank you guys for ever on this one...
its urgent...for me...please!!!
|
|
|
|
|
What are you having trouble with? If you are just looking for how to get a symbol into a text box, I would use the Chr() method. Start a new project, but textbox on the form, and then use this code and run the project...it will display a list of which integer values will be converted into which characters.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim sb As New System.Text.StringBuilder<br />
For intI As Integer = 1 To 255<br />
sb.Append(intI & vbTab & Chr(intI) & vbCrLf)<br />
Next<br />
TextBox1.Text = sb.ToString<br />
End Sub
Hope this helps.
|
|
|
|