|
Hi there!
A question for all folks that are using WeifenLuos DockManager (which I have to shortly intend is great!):
I've got two panes in my application. One is docked at the left and one has the state DockState.Document . I've got a couple of different DockContent derived Forms in this DocumentPanel. Depending on the users selection, I hide or show some of them using the appropriate functions Hide() and Show() of the DockContent deriatives.
Problem I'm having is that the documentPane (and it's Content windows) start flickering crazily. I've tried to ResumeLayout() and SuspendLayout() do supress layouting but it won't help. Goal is to supress any repainting until I'm set. Any ideas?
Thanks in advance!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
The best place for this question is on the discussion board under Weifen Luo's article, here[^]. He keeps it up to date and is the best person to ask about issues like this. It's also possible that it's a known bug and he just doesn't have a fix for it yet.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi, i have a counter that counts down from 5 minutes. i have 2 separate displays: 1. minute display(which counts down every 60 seconds), 2. seconds display(which counts down from a minute i.e. 00, 59, 58 ....). what i cant figure out is how to make the second counter to restart at 00 after a minute has gone by. can anyone help me? thanks.
Sincerely,
Jason C. Ranin
Software Quality Assurance
|
|
|
|
|
Why do you need two counters?
Why not just have one counter counting the seconds?
Assuming your counter variable is called counter , each time the timer fires you increment it. To get the seconds and minutes try:
int seconds = counter % 60;
int minutes = counter / 60;
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
i have a custome encrypt program for a foxpro database i have so i converted the program to csharp it encrypts data to and from a table but when i encrypt it using csharp i can't decrypt it because the charter maping in csharp is diffrent i think because i can encrypt the letter "a" using my method but i can't read it from the table in its encrypted form and turn it back into a "a" so can somebody help me
here is a copy of a method that dose basicly the same thing as the encrypt program i am trying to use the idea is the same and i can't change it because we have hundreds of programs that use this method to encrypt and decrypt data in these tables
public string encrypt(char[] txt)
{
int length=txt.Length;
int char_num;
StringBuilder result=new StringBuilder();
char[] out_array=new char[length];
double x,y,num;
for(char_num=1; char_num<=length; char_num++)
{
x=(double) txt[char_num-1];
y=0;
for(double bit=7;bit>=0;bit--)
{
num=(int) Math.Pow(2,bit)-1;
if(x > num)
{
num= Math.Pow(2,bit);
x=x-num;
num= Math.Pow(2,7-bit);
y=y+(num);
}
}
out_array[length-char_num]=(char) y;
}
for(char_num=0; char_num
|
|
|
|
|
cmarmr wrote:
but when i encrypt it using csharp i can't decrypt it because the charter maping in csharp is diffrent i think because i can encrypt the letter "a" using my method but i can't read it from the table in its encrypted form and turn it back into a "a"
Why can't you? An array of characters is an array of characters. Taking away the storage of a character array in memory, every language pretty much treats an array of characters the same.
Apparently, you store this in a table field as a sequence of characters, so that's what you get back, correct? So why can't you decrypt this? You're using a two-way hash (not very good encryption at all, but perhaps good enough for your requirements) so if you apply the hash algorithm in reverse on the ciphertext you end up with your plaintext.
If you're having problems with the decrypt method, I suggest you post it here.
Also, I noticed you have this declared as an instance method. Encrypt and Decrypt (notice the casing, too, which is consistent with the recommended .NET naming conventions) would probably work better as statics. I mean, unless you're encapsulating functionality into the containing class, these two methods are really more procedural. Just a suggestion.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
that is just a quit encrypt method i wrote to post on this web site and i know there are better ways to encrypt but this was written in foxpro 2.0 for dos and there are still about 500 programs that use it in my company just have not got around to changing it but i can use this program to encrypt text from a text box and put it back in the textbox and when i run it again it decrypts but as soon as i store it to a table it changes ther charter set to where i can't decrypt it
on and that encrypt method is my decrypt method too its just for testing
chad
|
|
|
|
|
ok let me explain what i tried i encrypted my name "chad" to a textbox and i cut it from the textbox and pasted it in a foxpro table after i pasted it there i cut it again from the foxpro table and pasted it back to a csharp from and tryied to decrypted it and could not and just to make sure i did not do anything wrong i also copy there encrypted text from the csharp form and trying to decrypted it and it works fine
as soon as i past the encrypted text into foxpro it changes the charters and it only seems to change charter from 128 and above can you help me fix this
chad
|
|
|
|
|
cmarmr wrote:
as soon as i past the encrypted text into foxpro it changes the charters and it only seems to change charter from 128 and above can you help me fix this
Now that's handy to know. The text encoding for that field in FoxPro is incorrect. .NET stores and operates on Unicode text natively. What FoxPro has defined for that field is ASCII, which is only characters 127 and below. A codepage (and different regions, countries, and makers have their own) defines the rest of the characters.
What you need to do is change the encoding of that field to UTF8 (like ASCII, but allows for 2-byte characters above 127, making it a good replacement for ASCII on older systems in order to support Unicode as well) or to Unicode (either UCS2 or UCS4).
The other option is to base64-encode the text so that only ASCII characters are used (thus not requiring a change in the FoxPro database). You can do this simply over the byte[] that represents the ciphertext (which is binary anyway - not text!) using Convert.ToBase64String and Convert.FromBase64String . Base64 is the common encoding used for ciphertext (encrypted text) because it's fairly compact and can easily represents arbitrary bytes.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok foxpros codepage is 1252 and it dose allow for characters above 128 it is double-byte characters
what else could i try
chad
|
|
|
|
|
As I asked before - are you encoding the encrypted byte[] array (which the .NET crytography classes create) as text? You have to use hex, base64, or some other encoding to save the cipher data as text. It is not enough to use Encoding.GetString , since many of those bytes are unprintable (and therefore can't be copied and pasted - something you said you're having problems with). Why do you think that notepad.exe displays tons of "funny" characters when you open a binary file (like a .dll or .doc)? It's not text - it's binary.
Trust me - I've been working with cryptography long before .NET. You must encode it as text that can be stored correctly, which is why I mentioned Convert.ToBase64String and Convert.FromBase64String . There's also several articles here on CodeProject and replies in this message board about saving cipher data as hex-encoded (base 16) strings. Both are pretty easy to do.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how to capture image from media player video?
|
|
|
|
|
Hi,
I have a table (ms access db) that has dates in each row. I want to be able to fill a dataset with records that fall within a date range. I'm using two dateTimePickers (win form) for start and end dates. How would I go about this? Should the dates in the access db be formated as date/text/number? Thanks for any help you can give.
Ron
|
|
|
|
|
Found it,
I was able to use the sql code below and have it work... don't know if it's the best or not. Didn't seem to matter if the date was text or Date DataType in db file.
SELECT * FROM Orders WHERE OrderDate>=? AND OrderDate<=?
Ron
|
|
|
|
|
See if the manufacturer of your video setup has an SDK available and use that. Otherwise, you can use the Windows Media Capture 9 suite, which you can get here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi, I'm trying to find a way to get the names of tables in a .mdb file programmatically. The OleDBDataAdapter requires that you use an SQL select statement, but that's a bit hard if you don't yet know the table names in a file. Any help, tips?
Thanks, Brian.
|
|
|
|
|
|
Hi, here's a code snippet of what I'm trying to do, but it throws an exception when I try to fill the dataset. I'm not familiar enough with .NET database stuff to know if this is the right way to go about it. Any ideas?
Thanks.
DataSet myDataSet = new DataSet();
string strAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ dataFile;
string strAccessSelect = "SELECT Name FROM MSysObjects WHERE Type = 1 AND Name LIKE 'MSys%'";
try
{
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter (strAccessSelect,strAccessConn);
myDataAdapter.Fill(myDataSet,"MSysObjects");
DataTableCollection dta = myDataSet.Tables;
Int32 iCount = dta.Count;
for(Int32 i=0;i
|
|
|
|
|
First of all, you want WHERE Type = 1 AND NOT Name LIKE 'MSys%' , as I wrote in my reply to your original post.
Second of all, don't waste time and resources with a DataSet when you only need a single column anyway:
using (OleDbConnection conn = new OleDbConnection(strAccessConn))
{
using (OleDbCommand cmd = conn.CreateCommand())
{
cmd.CommandText = strAccessSelect;
conn.Open();
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
cbTables.Items.Add(reader.GetString(0));
conn.Close();
}
} This is much more efficient - using a forward-only data reader instead of creating a DataSet schema and filling it, which is good for disconnected data, but terribly inefficient for something like this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
You might want to go into a little detail describing what you want to do. "How to config..." doesn't tell us anything...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You could always just do a "Your welcome." response and leave it at that. Clearly they don't even have the time to explain the problem and yet they want you to spend time figuring out their problem.
There is a slight inequity in this case....
|
|
|
|
|
I agree with Dave; if you need help, you need to be as specific as possible about what you need help with and what errors occured (no applicable here, of course) if any.
I do see what you're asking in this case, though. First you must understand that once a config file is read-in, it cannot be changed (well, at least the application won't recognize any changes). The reason is that the config section handlers, once read, are cached.
So, you either have to write changes to your .config file (make sure you keep what you don't modify in-tact) and restart your application (this is how ASP.NET works - a separate AppDomain monitors Web.config for changes and restarts the ASP.NET web application's AppDomain) and or use a different medium (some arbitrary XML configuration file, INI file, the registry (not recommended), a database, etc.).
Another option is to - for your own custom sections (see IConfigurationSectionHandler ) - create a settings class (what the section handler would return after the .config file is read) that can be changed programmatically and your code that uses those settings should not cache them.
For a good article on this topic, read An extension for a Configuration Settings class in .NET[^] here on CodeProject.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Suppose I have a custom type made of a list of floats, and I want to represent it compactly in XML like this:
<MyType>[2.718, 3.142, 1.613, 1.000]</MyType>
Suppose also that I have a dataset, with a datatable where one of the columns uses MyType, which is a essentailly a float[].
My question is this: How do I ensure the tag is written into this format and read properly back into the float[] when I use ds.WriteXml and ds.ReadXml mehtods? Is there an interface or something I implement in my custom type to write on the contents for the tag and also to parse it back in?
-- James --
|
|
|
|
|
Not without having to serialize the entire DataSet itself (using the undocumented IXmlSerializable interface) - not exactly something you want to do (it gets pretty complex if you want to remain compatible with the functionality of the DataSet ).
You could try, however, to create a typed DataSet (using xsd.exe or the DataSet designer in VS.NET - right-click on your project or project folder, select Add->Add New Item and add a "DataSet"), then modify the hidden source code (use Project->Show All Files) to transform a string into a float[] .
Keep in mind, however, that most databases (Oracle is the only major database I can think of that can hold an array, IIRC) can't hold arrays. So, in Access, MS SQL Server/MSDE, MySQL, etc., this would only be a string. So should it be in your DataSet (well, in most cases). Your caller should be responsibe for serializing and deserializing that string to/from a float[] , from a logical perspective.
Microsoft MVP, Visual C#
My Articles
|
|
|
|