|
can any one tell me the references regarding Slide-In Menu Bar
which can be created or implemented in windows application using c#??
thanks in advance............
|
|
|
|
|
|
No,
i want slidding window for my application which can be running while do another work on my pc,
i.e. like windows background services
when i want to look my current usage or that application when i move cursor on it,
slide bar from left/right/top/bottom
thanks for reply
|
|
|
|
|
If I could understand you, you should try creating a child form for a MDIParent and with child form's MouseMove event you can done it.
|
|
|
|
|
|
hi
i want to backup from my database i used following code but it do not work properly
and it rises an exception
(my database name is 'Alarms' )
Backup backup = new Backup();
backup.Action = BackupActionType.Database;
backup.BackupSetName = "Archive_NeaxExpander";
backup.Database = "Alarms";
backup.PercentCompleteNotification = 10;
BackupDeviceItem device = new BackupDeviceItem(path, DeviceType.File);
ServerConnection connection = new ServerConnection(new SqlConnection(ConnectionString));
Server server = new Server(connection);
Database DB = server.Databases["Alarms"];
backup.Initialize = true;
backup.Checksum = true;
backup.ContinueAfterError = true;
backup.Devices.Add(device);
backup.Incremental = false;
backup.FormatMedia = false;
backup.SqlBackup(server);
i recive following exception
Microsoft.SqlServer.Management.Smo.FailedOperationException was unhandled by user code HelpLink="http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Backup+Server&LinkId=20476"
Message="Backup failed for Server 'MRTSOFT-F5CFDAC'. "
Source="Microsoft.SqlServer.Smo"
Operation="Backup"
i used my current connectionstring as an addmin
to add , insert , select ,... and it works properly
and i sore that i have backup premission with this connectionstring
i used the following code to resive servers list
DataTable dtServers = SmoApplication.EnumAvailableSqlServers(false);
//or
DataTable dtServers = SmoApplication.EnumAvailableSqlServers(true);
but it`s dtServers.rows.count is zero and perhaps it means no server is available
so what can i do
i really confused by SQL
|
|
|
|
|
realize the truth
----------------------------------
Be excellent to each other
|
|
|
|
|
I need to implement vfp function which uses * and ? wildcards:
static bool Like( cExpression1, cExpression2)
cExpression1
Specifies the character expression that Like( ) compares with cExpression2.
cExpression1 can contain the wildcards such as * and ?. The question mark
(?) matches any single character in cExpression2 and the asterisk (*)
matches any number of characters. You can mix any number of wildcards in any
combination in cExpression1.
cExpression2
Specifies the character expression LIKE( ) compares with cExpression1.
returns true on wildcards match.
How to implement this ?
Andrus
|
|
|
|
|
You should look up Regex (Regular Expressions), it should do everything you need (and oh so much more)
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
You should look at using regular expressions. Do a search on this site for Expresso, it is a really cool tool for building regular expressions.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
Is there a way to use the .NET cryptography library to encrypt binary files as opposed to plain text files? I've been having a few issues with the way that encrypted bytes are decrypted back to their original state.
What I do to initialize my algorithm for decryption is approximately the following:
UnicodeEncoding byteConverter = new UnicodeEncoding();
RijndaelManaged algorithm = new RijndaelManaged();
algorithm.IV = byteConverter->GetBytes();
algorithm.Key = byteConverter->GetBytes();
return alg;
In order to encrypt, first, I call that stub of algorithm initialization code. Then I do approximately the following with a Byte[] data that I want to encrypt:
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, algorithm.CreateEncryptor(), CryptoStreamMode.Write);
for (int i = 0; i < numBytes; i++)
{
cs.WriteByte(data[i]);
}
cs.FlushFinalBlock();
byte encoded[] = ms.ToArray();
cs.Close();
ms.Close();
string output = Convert.ToBase64String(encoded);
In order to decrypt, first, I call that stub of algorithm initialization code. Then I do approximately the following with a string input that I want to decrypt:
byte[] encoded = Convert.FromBase64String(input);
MemoryStream ms = new MemoryStream(encoded);
CryptoStream cs = new CryptoStream(ms, algorithm.CreateDecryptor(), CryptoStreamMode.Read);
byte decoded[] = new byte[encoded.Length];
for (int i = 0; i < decoded.Length; i++)
{
int readByte = cs.ReadByte();
if (readByte != -1)
{
decoded[i] = (byte)readByte;
}
}
cs.Close();
ms.Close();
The problem is that if I call Encrypt , then Decrypt , encryption leaves me with a nice base64 string, which decrypt easily converts back to a byte array. But when I read the CryptoStream and get check all the values of int readByte everytime I read a byte, as soon as I come to the null-terminated character (0 '' ), everything else that I read after that is the same garbage symbol (-51 'Í' ). More precisely, the code that I'm writing here is the C# equivalent of my Managed C++ code (however, the problem does not lie in the unmanaged part or the unmanaged/managed conversion). So, to rephrase what I mean, say that I'm checking all the values of readByte for i = 0 to the length of the decoded byte array (which hasn't yet been filled), if ReadByte happens to return me 66, 77, 54, 44, 23, 0, respectively, everything else after that is -51. If I'm decrypting binary data, I will run into this issue. If I'm decrypting text data, then I won't, since in a text string, 0 is the null-terminated character that only occurs at the very end of the string (and I've got all my bytes at that point anyway).
Any suggestions? Thanks, and I apologize for the long post.
|
|
|
|
|
Skip the base 64 string part. Since you are using a binary file you should be using a FileStream or some other stream. I have never had any trouble encrypting streams.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Well, base64 is easily encoded in a string, or a MemoryStream (which is what I'm using). What I'm essentially doing afterwards when I write to a file is actually saving the base64 encoded string directly to the file like I save text. Thanks for the FileStream suggestion... maybe that's also a plausible implementation.
Also, I've toyed around with the idea of doing multiple base64 conversions, so converting a binary file to base64 first, then encrypting, then encoding to base64 again. After every base64 transform step, I'm able to again fit the entire "data" of the file into an ANSI string.
|
|
|
|
|
I just figured out the issue, and it had nothing to do with the CryptoStream. I was simply deceived and made the wrong assumptions. In the end, it was because I never opened the file in binary mode, so it was being parsed as a string.
|
|
|
|
|
You have a binary file, and the crypto stream only encrypts or decrypts binary data. There is no reason at all to turn the data into a string.
As I always say:
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
This is a little library I use. I pulled it together from various sources and stake no claim to it. It will encrypt binary and strings using public/private key encryption and standard passphrase encryption. Hope it's of some help.
Crptography.zip[^]
|
|
|
|
|
Hi,
Is there a way to produce a partial method with CodeDom?
Ex. partial void MyMethod() { ... }
It looks like the MemberAttributes doesn't have "Partial" in it
CodeMemberMethod codeMemberMethod = new CodeMemberMethod();
codeMemberMethod.Attributes = MemberAttributes.Public...but no MemberAttributes.Partial?
My problem is that I'm generating some code to implement partial method.
I have this class (created "by hand"):
public partial class MyClass
{
partial void MyMethod();
partial void MyMethodB();
}
Then with CodeDom, I want to generate the implementation of those partial method. Something like:
public partial class MyClass
{
partial void MyMethod()
{
}
partial void MyMethodB()
{
}
}
That's why I need the "Partial" in System.CodeDom.MemberAttributes.
May be I'm all wrong...it's something else the MemberAttributes that I should use to do this?
Thank
|
|
|
|
|
Create an abstract class and then use CodeDom to return an instance. You don't even need an abstract class as you can use an interface as well.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Sorry, but the CodeDOM classes don't support partial methods.
|
|
|
|
|
|
I created 3000 labels and added them into my form (I really didn't need these labels, I was just testing).
My C# code:
int x, y;
Label[] lab = new Label[3000];
for (int i = 0; i < 3000; i++)
{
lab[i] = new Label();
x = i / 100;
y = i % 100;
lab[i].Tag = string.Format("{0},{1}", x.ToString(), y.ToString());
lab[i].AutoSize = false;
lab[i].Top = (x - 1) * 10;
lab[i].Left = (y - 1) * 10;
lab[i].Height = 10;
lab[i].Width = 10;
this.Controls.Add(lab[i]);
}
My VB6.0 code:
Dim i%
Dim x$
Dim y$
For i% = 2 To 3000
Load lblPage(t%)
x$ = i% \ 100 + 1
y$ = i% Mod 100
lblPage(i%).Tag = x$ + "," + y$
lblPage(i%).Top = (i% \ 100) * lblPage(1).Height
lblPage(i%).Left = (i% Mod 100 - 1) * lblPage(1).Width
lblPage(i%).Visible = True
Next i%
And my problem is speed!
C#: about 5seconds
VB6: less than a second!!!
Why?
Besides I have to insert approximately 100MB .Net Framework package in my installation package while I really don't need all of .Net Framework features, in this case I have to tell my users: "Please be patient! We'll continue after a while! "
Is there anyway to solve these problems? If not I think I'll not use C# anymore!
|
|
|
|
|
Pedram Behroozi wrote: And my problem is speed!
Then use C++...
Stupidity is an International Association - Enrique Jardiel Poncela
Die deutsche Sprache sollte sanft und ehrfurchtsvoll zu den toten Sprachen abgelegt werden, denn nur die Toten haben die Zeit, diese Sprache zu lernen. - Mark Twain
|
|
|
|
|
You're creating 3000 labels and adding them to the screen. Of course that's gonna be slow; that's a horrible abuse of the UI system. (As many VB6 apps are!)
Your VB6 code is different than your C# code. The C# code creates 3000 labels and adds them to the screen. Your VB6 code assumes your labels are already created and merely sets their visible status.
Tell us what you're trying to do. We'll tell you how to get good performance.
Pedram Behroozi wrote: Besides I have to insert approximately 100MB .Net Framework
Use the .NET 3.5 SP1 client profile. It's just over 20MB.
Another thing to consider is that all Windows Vista machines come pre-installed with .NET 3.
modified on Friday, September 26, 2008 1:50 PM
|
|
|
|
|
Judah Himango wrote: Tell us what you're trying to do. We'll tell you how to get good performance.
As I said before, I was just testing. I encountered the speed problem before in many cases. Like reading records from a file using StreamReader or even BinaryReader while the same VB6 application executed that in a moment!
Judah Himango wrote: Use the .NET 3.5 SP1 client profile. It's just over 20MB.
Even 20MB is a huge size! Imagine I want to write a simple Phonebook, My application needs 20.01MB free space!
|
|
|
|