I'm trying to make a file encrypter and password hasher so I need a random number generator for the file encrypt.
All Im trying to do is generate some numbers and then set the text of a textbox to those numbers but it won't let me
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
int ki [65] = {0};
String ^ txtVal;
for(int c = 1;c < h + 1;c++){
ki[c] = rand() % 456 - 12;}
key->Text = Convert::ToString(ki);
}
It compiles but it doesn't actually do anything when I press the button.
I even made ki a single integer and it still didn't output it to the textbox.
Need help visualc++ being difficult
Started by c0mputer-fr0d, Aug 05 2012 11:08 PM
5 replies to this topic
#1
Posted 05 August 2012 - 11:08 PM
#2
Posted 06 August 2012 - 09:15 AM
try invalidating the display, it may be that the textbox has changed but the changes have not made it to video memory.
If it's a form application, this.Invalidate(); should do it
If it's a form application, this.Invalidate(); should do it
#3
Posted 07 August 2012 - 05:03 PM
No luck
textBox1->Text = "this shit is bananas";
this->textBox1->Invalidate();
I tried this but didn't work. Thank you though
textBox1->Text = "this shit is bananas";
this->textBox1->Invalidate();
I tried this but didn't work. Thank you though
#4
Posted 07 August 2012 - 06:20 PM
You shouldn't have to invalidate any standard controls. The control will do that for you whenever you set a property (unless you're in a separate thread, which is a no-no). Is this .NET forms? You shouldn't have any problems setting the text value of the control. My guess is that there's something else at play here. Check to make sure you have a reference to the correct textbox you're trying to modify. Make sure the control is enabled and doesn't have a MaxLength set to 0 or some such.
http://www.nutty.ca - Being a nut has its advantages.
#5
Posted 08 August 2012 - 09:23 AM
Individual items in the gui auto invalidate, that is correct. However the windows form itself may not.
I have had hundreds of occasions when I have to call Invalidate() on the whole form before changes appear
I have had hundreds of occasions when I have to call Invalidate() on the whole form before changes appear
#6
Posted 10 August 2012 - 02:04 PM
Fixed it by generating a new button click function. Thank you.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












