|
I had write this code
for (int i = 0; i < totalEquipment; i++)
try
{
for (int j = 0; j < sEquip[index].index; j++)
{
try
{
...
bar[j].Size = new Size(length,20);
bar[j].BackColor = System.Drawing.Color.Blue;
bar[j].Location = new Point(xPosition,yPosition);
this.Controls.Add(bar[j]);
...
}
catch (Exception ex)
{
throw new Exception(ex.Message + " " + ex.StackTrace);
}
finally
{
xPosition += length;
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message + " " + ex.StackTrace);
}
finally
{
yPosition -= range;
}
}
}
The problem is this part which it keep add panel to window form without stoping like non stop looping. How can i stop this error?
try
{
...
bar[j].Size = new Size(length,20);
bar[j].BackColor = System.Drawing.Color.Blue;
bar[j].Location = new Point(xPosition,yPosition);
this.Controls.Add(bar[j]);
...
}
|
|
|
|
|
shamsteady wrote: for (int i = 0; i < totalEquipment; i++)
try
{
for (int j = 0; j < sEquip[index].index; j++)
This may be seem stupid but what's the value of totalEquipment multiplied by sEquip[index].index ?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I need to make a little c# program which copies a text into the clipboard and that pastes this data into the active window. I am looking to automatically paste into active window, from my code.
I copy the data like this
Clipboard.SetText("mystring");
but i don't know how to paste this data into the active window (notepad, word for example). I guess I have to use the GetForegroundWindow API function, but i am a beginner and I don't know how I could do this
thanks for your help
|
|
|
|
|
Hello everyone,
I am working on a DVD Windows Application and it is almost done and fully functional. The project is done in C# using DirectShow programing.
I would like to add a control panel to the Application which is appeared only for a short period of time (5 second) and get disappears after not using the mouse or keyboard. Just like the one you have when you have your DVD Playback software in Fullscreen option.
can someone be kind enough to point me to the right direction and tell me where I need to start if I wish to add such a control panel?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
You just put a timer inside the form, so it closes itself after 5 seconds - the timer resets itself on every keyboard or mouse event. Is that the bit you needed help with ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello Chritian,
Thank you for your respond. That sounds exactly whasiblet I need. Would it possible for you to give some info and tips how to get this done?
Your help is greatly appricated.
Khoramdin
|
|
|
|
|
Hi all
i have typed Data set with it's data Adaptors
i need to make public sub and send to it the data adaptor as parameter
and for each screen i call this sub i will put my current data adaptor in the parameter place
how can i do this
thx
|
|
|
|
|
In the VB forum ^
Please don't spam.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Im trying to add panel in window form by using this method.
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel mypanel;
private void InitializeComponent()
{
...
this.mypanel = new System.Windows.Forms.Panel();
...
}
...
...
this.Controls.Add(this.mypanel);
Is there other way to display panel besides using "this.Controls.Add(this.mypanel);" method?
|
|
|
|
|
Yes, you can use:
this.mypanel.Parent = this;
|
|
|
|
|
|
Hi
I want to filter input data in DatagridView control. For example preventing entering numeric values in 'Name column' or preventing entering alphabetic values in 'Pricre column'. I mean i want to lock keyboard's number keys when user focuses on cell that should enter "Customer Name" avoiding entering wrong data.
Tanx
|
|
|
|
|
I think that using generic columns you can't control it. You must create your own custom column (inherited from TextboxColumn) and implement your validation
|
|
|
|
|
i have a toolstrip in my form and my form is scrollable but when i scroll the page toolstrip's location changed i want always toolstrip at the top of page
how can i do it ?
Thanks
MHF
|
|
|
|
|
Set its dock property to TOP
|
|
|
|
|
ok i set it but when i scroll the page to down the toolstrip go away from the form
i want always tooltrip is in the form
MHf
|
|
|
|
|
oh!
if you want keep it visible all the time then you can achieve it by two ways either take two panels add your controls on different panels or change
its location with the scrolled margin
|
|
|
|
|
You have to move the ToolStip out of the control that is scrollable.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I had write this code
for (int i = 0; i < totalEquipment; i++)
try
{
for (int j = 0; j < sEquip[index].index; j++)
{
try
{
...
bar[j].Size = new Size(length,20);
bar[j].BackColor = System.Drawing.Color.Blue;
bar[j].Location = new Point(xPosition,yPosition);
this.Controls.Add(bar[j]);
...
}
catch (Exception ex)
{
throw new Exception(ex.Message + " " + ex.StackTrace);
}
finally
{
xPosition += length;
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message + " " + ex.StackTrace);
}
finally
{
yPosition -= range;
}
}
}
The problem is this part which it keep add panel to window form without stoping like non stop looping. How can i stop this error?
try
{
...
bar[j].Size = new Size(length,20);
bar[j].BackColor = System.Drawing.Color.Blue;
bar[j].Location = new Point(xPosition,yPosition);
this.Controls.Add(bar[j]);
...
}
|
|
|
|
|
There is nothing in that code that would create a loop.
I assume that ... means that there are more code in the block, what does that code contain?
---
single minded; short sighted; long gone;
|
|
|
|
|
The code contain an array of panel that will be add to window form. It will be display according to the number of input. The problem is the panel will be display but it keep blinking during runtime meaning that it generate too many panel...
|
|
|
|
|
Why all the try statements ?
You need to step through the code to see what is going on.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I am having a problem decrypting a des file or well in this test case a des string. I'm not sure if my error is in the Encrypting or the Decrypting so i will post code for both. This is what i am calling.
<br />
string Key = Security.CreateKey();<br />
Console.WriteLine(Encoding.ASCII.GetString(Security.Decrypt(Security.Encrypt(Encoding.ASCII.GetBytes("Test"), Key), Key)));<br />
But giberish is returned rather than "Test"... Obviously encoding and decoding are using the same key so i'm not exactlly sure is going on . Any help anyone could offer would be GREATLY appreciated.
Thanks in advance!
<br />
public string CreateKey()<br />
{<br />
DESCryptoServiceProvider desCrypto = (DESCryptoServiceProvider)DESCryptoServiceProvider.Create();<br />
return ASCIIEncoding.ASCII.GetString(desCrypto.Key);<br />
}<br />
<br />
public byte[] Encrypt (byte[] Data, string Key)<br />
{<br />
MemoryStream MemStream = new MemoryStream();<br />
DESCryptoServiceProvider Des = new DESCryptoServiceProvider();<br />
SetDesKey(Des, Key);<br />
<br />
ICryptoTransform DesEncrypt = Des.CreateEncryptor();<br />
CryptoStream CryptStream = new CryptoStream(MemStream, DesEncrypt, CryptoStreamMode.Write);<br />
CryptStream.Write(Data, 0, Data.Length);<br />
CryptStream.Close();<br />
<br />
return MemStream.ToArray();<br />
}<br />
<br />
public byte[] Decrypt(byte[] Data, string Key)<br />
{<br />
byte[] returnContainer;<br />
MemoryStream MemStream = new MemoryStream(Data);<br />
<br />
DESCryptoServiceProvider Des = new DESCryptoServiceProvider();<br />
SetDesKey(Des, Key);<br />
<br />
ICryptoTransform DesEncrypt = Des.CreateEncryptor();<br />
CryptoStream CryptStream = new CryptoStream(MemStream, DesEncrypt, CryptoStreamMode.Read);<br />
<br />
returnContainer = new byte[MemStream.Length];<br />
CryptStream.Read(returnContainer, 0, returnContainer.Length);<br />
CryptStream.Close();<br />
<br />
return returnContainer;<br />
}<br />
<br />
private void SetDesKey(DESCryptoServiceProvider DESProvider, String password)<br />
{<br />
int i;<br />
Byte[] bytePassword;<br />
bytePassword = (new ASCIIEncoding()).GetBytes(password);<br />
Byte[] passwordHash;<br />
SHA1Managed SHhash = new SHA1Managed();<br />
<br />
passwordHash = SHhash.ComputeHash(bytePassword);<br />
<br />
Byte[] pwh = new Byte[8];<br />
for (i = 0; i < 8; i++)<br />
pwh[i] = passwordHash[i];<br />
<br />
Byte[] pwiv = new Byte[8];<br />
for (int j = 7; i < 16; i++)<br />
pwiv[j] = passwordHash[j + 7];<br />
<br />
DESProvider.Key = pwh;<br />
DESProvider.IV = pwiv;<br />
}<br />
|
|
|
|
|
In the Decrypt function, you need to call CreateDecryptor instead of CreateEncryptor .
|
|
|
|
|
OMG ok... i kinda feel dumb now.. *sigh* i guess it happends...
thank you very much dominik.
|
|
|
|