|
Sir Thanks alot for your interest.
I have figured out the solution. Yes Chiper is my own class all is working well. I just mistakenly converted the decrypted bytes into Base64 string as i do after Chiper.Encrypt() replacing return Convert.ToBase64String() to return Encoding.ASCII.GetString() in Chiper.Decrypt() method. It's working fine now thanks alot again.
Yeh that'sll be my help if you tell me whats the difference between Base64 string and the string one we get from Encoding.ASCII.GetString()??? and why it is needed in in the Encryption classes? Why Encoding.ASCII looses the information?? Thanks alot again Sir.
Best Regards,
Rizwan Ahmed
|
|
|
|
|
base64 is a binary encoding scheme for email attachments. The email protocalls are ancient and were written so long ago that the performance gained by using 7 bit bytes instead of 8bit bytes. Base 64 takes a series (7bytes?) of 8bit bytes and encodes them as series of 7 bit bytes (8bytes?) which are represented in modern hardware as 8 bit bytes with the high bit set to zero. It might also contain parity or ECC bits, I'm not overly familiar with it.
|
|
|
|
|
Helo.
I have to do a custom control which represents the wireless connections of a device. It looks like a listview, but it must be custom (it must look in a certain way, and its elements are pretty complicated). I also must implement a vertical scroll, in case the connections don't fit the window.
Anyway, I am not really sure of how to implement these things. How do I make the (custom) listview scrollable? I can't use the standard scrollbar because it also must match the look of the application.
Thanks
|
|
|
|
|
i posted a question about customize a scrollbar, and i get the advice to create one by alone!
Use 3 panels 1 for the up button, one for the scroller and one for the down button.
then place your own graphic inside.
Just a bit of code and you get your custom scrollbar.
If you have problem, just ask!
|
|
|
|
|
yeah, I thought of that, but how do I implement the custom listview such that only a portion of it is to appear on the screen? If I can do this well, the scroll bar thing will be pretty easy.
|
|
|
|
|
Being new to C# I have always wondered, how do people know the following:
Classes and there methods and what method is doing what?
For eg:
DataGridTextBoxColum > to achieve custom looks override the Paint method!
How do they know to do that? Is there a manual out there that I don't know about?
Or another good one:
//To invoke the method used when user double click on column to resize!
MethodInfo m = t.GetMethod("ColAutoResize", BindingFlags.Instance | BindingFlags.NonPublic);
How do you know that? Who tells a person to go and get the information from? I would love to know all that can some one here solve this mystry please??? thakns
|
|
|
|
|
Take this documentation + some experience + google and you're done
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
There is no manual that explains all this stuff. It's just put together from A LOT of experience and research. A lot of the code you see is dictated by how Windows works, which is documented here[^]. When the Windows API was written, it was done with C++ in mind, not the .NET Framework. So all the code and examples in the Platform SDK will be written in C++. You have to translate the code into whatever language you're using.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote: So all the code and examples in the Platform SDK will be written in C++
Huh? If you need C# documentation MSDN has everything you need.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I think you mis-understood what I was talking about. The C# documentation DOESN'T cover the Windows internals like the Platform SDK does.
It covers stuff like, "to do this, write that". It doesn't cover why it works the way it does. For example, overriding WndProc. You can easily capture any and all window messages headed for your app and react to them, but the C# documentation doesn't go into what a window message is or how windows actually work.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Taurian110 wrote: How do they know to do that? Is there a manual out there that I don't know about?
My main source of information is reading articles, books[^], magazines (like MSDN Magazine[^], Software Development Magazine[^]), attending/organising user groups (Scottish Developers[^], Agile Scotland[^], eXtreme Wednesdays[^]), listening to DotNetRocks[^], and IT Conversations[^]
I hope I've not left anything out.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Another good resource are Reflector-like tools. If you don't understand what a special class does than you can just look into the code.
|
|
|
|
|
Hi,
When the print button is clicked, I save a snapshot of the screen to a bitmap file.
Graphics currentTab = this.CreateGraphics(); <br />
Size s = this.Size;<br />
Bitmap memoryImage = new Bitmap(s.Width - 10, s.Height - 36, currentTab);<br />
Graphics memoryGraphics = Graphics.FromImage(memoryImage);<br />
IntPtr dc1 = currentTab.GetHdc();<br />
IntPtr dc2 = memoryGraphics.GetHdc();<br />
BitBlt(dc2, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height, dc1, 2, 2, 13369376);<br />
CurrentPage = memoryImage;<br />
currentTab.ReleaseHdc(dc1);<br />
memoryGraphics.ReleaseHdc(dc2);<br />
CurrentPage.Save("sCurrentPage.bmp",System.Drawing.Imaging.ImageFormat.Bmp);
Then I start to do the printing.
PrintDocument ppd = new PrintDocument(); <br />
PageSetupDialog pg = new PageSetupDialog();<br />
printDialog1.Document = ppd;<br />
pg.Document = ppd;<br />
pg.PageSettings.Landscape = true;<br />
DialogResult result = printDialog1.ShowDialog();<br />
if (result==DialogResult.OK)<br />
{<br />
ppd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintCurrentPage);<br />
ppd.Print(); <br />
}<br />
ppd.Dispose();
The first time I print, everything works ok. But if I hit the button again, I get an error, and the current screen doesn't save. (An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in system.drawing.dll Additional information: A generic error occurred in GDI+.)
If I comment out the printing part, the current page saves just fine. I also commented out just the line ppd.Print(); . The image saved fine and I didn't get any error messages. Any thoughts?
Cheers,
Mel
|
|
|
|
|
Where is the function: 'BitBlt'? Is it a Win32 function or is it somewhere in the .Net Framework, or did you write it?
I get "system.drawing.dll Additional information: A generic error occurred in GDI+" in any application when I try to save a Bitmap to the same file more than once. Try changing the name of this file after every save.
Ex:
First time name would be "sCurrentPage0.bmp"
then "sCurrentPage1.bmp"
"sCurrentPage2.bmp"...
|
|
|
|
|
I've made an app that has a main screen. When the form loads, it looks for dlls in a subfolder, finds them gets their display names from a class function in them, adds them to the menu and displays the form in the dll for the menu item.
However, there are common functions that will need to be ran by the other forms in the separate dlls. I don't want to create a separate dll, I want them to use the code from the main form.
Should I send in a reference to the main form, and if so, how can I get the dll form to call the function in the main form? Or should I be trying to use a delegate?
As you can tell, I'm pretty new to C#. I know how to do this in C++, but I'm kinda confused in C#. So any help is appreciated. Don't mind dumbing it down for me.
My articles
BlackDice
|
|
|
|
|
nevermind. I got it. I just sent a reference to the form in and called InvokeMember().
My articles
BlackDice
|
|
|
|
|
Hi,
I am running sql server Dev. and visual web developer 2005. It seems that I can not create a local database using VWD 2005. Is this because I have to have sql server Express edition in order to be able to create a local database using the VWD 2005?
Thanks
|
|
|
|
|
In fact, you can use your current SQL server to create a local database.
|
|
|
|
|
Hi,
We have a win32 dll for communicating with the MSR device.
I have a c# class for calling the dll functions as follows.
<br />
public class MSRsTest<br />
{<br />
private int usbMode = 0;<br />
<br />
[MarshalAs(UnmanagedType.LPStr)]<br />
private StringBuilder szSerNumber = new StringBuilder(100,200);<br />
[MarshalAs(UnmanagedType.LPStr)]<br />
private StringBuilder szTrack1 = new StringBuilder(100,200);<br />
[MarshalAs(UnmanagedType.LPStr)]<br />
private StringBuilder szTrack2 = new StringBuilder(100,200);<br />
[MarshalAs(UnmanagedType.LPStr)]<br />
private StringBuilder szTrack3 = new StringBuilder(100,200);<br />
<br />
[DllImport( "ReadUSB_MSR_DLL.dll", CharSet = CharSet.Unicode )]<br />
public static extern int fnOpen_USB_MSR(int usbMode);<br />
<br />
[DllImport( "ReadUSB_MSR_DLL.dll", CharSet = CharSet.Unicode )]<br />
public static extern int fnReadUSB_MSR_Data(int usbMode,<br />
[MarshalAs(UnmanagedType.LPStr)] StringBuilder szTrack1,<br />
[MarshalAs(UnmanagedType.LPStr)] StringBuilder szTrack2,<br />
[MarshalAs(UnmanagedType.LPStr)] StringBuilder szTrack3);<br />
<br />
[DllImport( "ReadUSB_MSR_DLL.dll", CharSet = CharSet.Unicode )]<br />
public static extern int fnClose_USB_MSR();<br />
<br />
<br />
public MSRsTest(){}<br />
<br />
public void Do_HIDMSR_Test(System.Windows.Forms.TextBox Track1,<br />
System.Windows.Forms.TextBox Track2,<br />
System.Windows.Forms.TextBox Track3<br />
)<br />
{<br />
int iretn;<br />
usbMode = 1;<br />
try <br />
{<br />
iretn = fnOpen_USB_MSR(usbMode); <br />
<br />
<br />
iretn = 0;<br />
while(iretn == 0)<br />
{ <br />
iretn = fnReadUSB_MSR_Data(usbMode,szTrack1,szTrack2,szTrack3);<br />
}<br />
<br />
if(szTrack1.ToString().Length >= 22 && szTrack2.ToString().Length >= 22 &&<br />
szTrack3.ToString().Length >= 22)<br />
{<br />
Track1.Text = szTrack1.ToString(0,22);<br />
Track2.Text = szTrack2.ToString(0,22);<br />
Track3.Text = szTrack3.ToString(0,22);<br />
}<br />
else<br />
{<br />
Track1.Text = szTrack1.ToString();<br />
Track2.Text = szTrack2.ToString();<br />
Track3.Text = szTrack3.ToString();<br />
}<br />
<br />
szTrack1.Remove(0,szTrack1.Length);<br />
szTrack2.Remove(0,szTrack2.Length);<br />
szTrack3.Remove(0,szTrack3.Length);<br />
<br />
iretn = 0;<br />
iretn = fnClose_USB_MSR();<br />
<br />
}<br />
catch(Exception){}<br />
}<br />
I call this class from my MSRform
as
MSRsTest TestMSR = new MSRsTest(); <br />
else if(MSR_type == "USBHIDMSR")<br />
{<br />
this.Statuslabel.Text = "USB HID MSR: Swipe Card";<br />
this.Statuslabel.Refresh();<br />
TestMSR.Do_HIDMSR_Test(this.Track1TB,this.Track2TB,this.Track3TB);<br />
}
every thing works fine. The MSR returns backs the correct value for the first time. But after navigating to some other forms, if I come to the MSRform again and do the procedure the values read from the card ie. the dll gets junk values form the card.
But in the first time itself if I do a for loop inside else if(MSR_type == "USBHIDMSR") then the MSR reads correct values no matter how many times I do inside the loop.
What's the problem...I am missing to do something but could'nt figure out...pls help.
Thanks.
|
|
|
|
|
When configuring a sqldatasource through the wizard I see that in
advanced sql generation options the two checkboxes are greyed out in visual web developer 2005.
How is it possible to enable these please?
Thanks
|
|
|
|
|
I've never used the web developer version. But, by chance is your backend an Access database? It would make sense that those options are greyed out because Access only supports single statement queries.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
+ In the table/view dropdownlist, you should select a table, not a view.
+ Then select columns, make sure the primary column is selected.
+ Click Advanced, the first option is available.
+ Select the first option, the second option is available.
|
|
|
|
|
Hi,
I want to delete a C# class object and all the resources used by the class before the garbage collector does it.
How do I do it in C#.
Thanks.
|
|
|
|
|
If the object represents a truly limited resource, it should implement IDisposable and then one would call <code>object.Dispose() when they are done with it. If it isn't a limited resource that needs active maintaince then let the system handle it by normal garbage collection.
|
|
|
|
|
You don't.
If the class inherits IDisposable, e.g. has a Dispose method, you call that method to clean up any unmanaged resources. Then you get rid of the reference to the object, and it will be garbage collected eventually.
You can invoke a garbage collection manually, but there is very rarely any reason to do so. If the system or the .NET heap needs more memory, a garbage collection will occur to try to free up memory.
---
b { font-weight: normal; }
|
|
|
|
|