|
|
Yeah my actual code does deal with it as a stream but it generates the same string as the Image.Save(memoryStream) method. Basically I'm using a third party charting component which has a save method which is able to save to a stream, I assume it uses the same method as the Image.Save does as it generates the same base64 string. I was hoping if i could get to the bottom of the reason I am getting two different strings I could take that solution to my actual code.
I can see now that the string is exactly the same, except the file IO method has more bytes on the end that are missing from the other method.
|
|
|
|
|
Hi
I have two forms, main form and login form, I need both forms to load at the start of my application (login form in front of main). The user shouild not be able to switch focus to the main form intil a successful login is accomplished. I'm loading both forms from a main method of another class. I played around with Application.run and ShowDialog methods without achieving wanted results. Any ideas are appriciated.
Thank you
|
|
|
|
|
Using application.run you can load your login form before the main form.
What you are describing sounds like you want to use ShowDialog in the activated or paint event to set an authentication token in the main form. That way you will have both forms on the screen at the same time.
|
|
|
|
|
What I would do is run the main form normally, and then handle the Activated event for the form, and if it's the first time, display the dialog.
bool firstTime = true;
protected override void OnActivated(EventArgs e)
{
if(firstTime)
{
firstTime = false;
LoginForm form = new LoginForm();
form.ShowDialog(this);
}
} That should work, displaying the main form and the login form on top of it.
But, my real solution would be to implement a main form with everything disabled if no user is logged in. This way a user can log in, then log out, and then another user log in without terminating your app, and only the corresponding menu items would be enabled.
And then, in the Activated event for the first time, simulate that the Log In menu item was selected. This way, if the user can't log in (invalid user or password), the application does not have to end.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
If I understood correctly, both suggestions involve controling the displaying of the login form from within the main form. Is there a way to accomplish the same thing (displaying both forms) from a 'static void Main() ' method from a third class- the class that I'll use to start the application.
Thank you in advance
|
|
|
|
|
The reason we are suggesting this is because it is the way that .net forms are implemented. The typical windows approach for this type of UI is to use a modal dialog which prevents the parent form from accepting input while the modal dialog is active.
If you don't care about disabling the main form you can just call Show() on the login form and ShowDialog on the main form, then both forms will be active. However, you need to setup some way for both forms to share state information and keep thier UIs synchronized.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
The thing is that Application.Run blocks until your form is closed, so you can't do anything from your Main while your form is displayed. You either have to display the login form and act on it before displaying your main form, or display your login form from within your main form.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I think it should be possible to handle the Activated event from somewhere instead of overriding OnActivated in the form itself. The code within the handler should be the same as now.
|
|
|
|
|
Hi, guys, I am now developing a drawing program in C#. Everytime when adding new lines, ellipse or other shapes, I have to use "this.Invalidate(); this.Update();" to refresh the drawing area then new
shapes will appear. However, it has to paint all the shapes I drew before, or the shapes I drew before may be erased!
But everytime redrawing every shape causes terribly flicking! How to avoid this? Can it only draw newly-drawn shape?
ps: I use ControlStyles.DoubleBuffer and ControlStyles.UserPaint. The effect is not obvious.
Many thanks!
Radic
Beijing, China
-- modified at 21:25 Sunday 28th August, 2005
|
|
|
|
|
You need to look into double buffering. You can actually set up C# to do this for you, just google double buffer C# and you're sure to find plenty of info.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks, Christian! Absolutely you are the most warm-hearted!
|
|
|
|
|
Don't know where the value was taken of this line...
public const int OF_SHARE_DENY_WRITE = 32;
This is regarding the avifil32.dll... Where did the programmer get the value "32"? Where can you get a reference of this kinds of values that would be passed into parameters... Thanks for the help...
-- modified at 21:12 Sunday 28th August, 2005
|
|
|
|
|
boggs wrote:
Where did the programmer get the value "32"?
Probably from the C++ header file that defines it.
boggs wrote:
can you get a reference of this kinds of values that would be passed into parameters...
In the C++ header files where they are defined, or just create a C++ project, type the names in and hover the mouse, you'll generally see the value in the status bar.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Oh... Thanks... I think I'll try that...
|
|
|
|
|
is consuming in c#?
I.E. is there a general purpose method of determining how much memory a HashTable or string or any other object is using?
"A preoccupation with the next world pretty clearly signals an inability to cope credibly with this one."
|
|
|
|
|
Have a look at the SizeOf method of the System.Runtime.InteropServices.Marshal class.
---
b { font-weight: normal; }
|
|
|
|
|
The marshaling call will work, you can also load up winDbg and use SOS to look at all the .net memory allocations.
|
|
|
|
|
It's only for structs, not for classes.
The only way of getting a rough estimate of the size of a managed object is by serializing it. The serialized size is actually bigger than the size in memory, but it can help you to spot who's taking memory.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
Hi All,
Can anybody help me how to convert Copybook data into Excel SpreadSheet using C# .I am new to Copy book.The copybook structure as follows.
*****Copybook1*****
05 IC-Record-ID PIC X(02)
value'IC'
05 IC-TPA-ID PIC x(06)
05 IC-Employer-ID PIC X(09)
05 IC-Plan-ID PIC x(09)
05 IC-Employee-ID PIC X(30)
05 IC-Account-Type-Code PIC X(04)
05 IC-Plan-Start-Date PIC x(08)
05 IC-Plan-End-Date PIC x(08)
05 IC-Account-Status PIC 9(01)
88 IC-Acct-New value 1.
88.IC-Acct-Active value 2.
88,IC-Acct-Temp-Inactive value 3.
88.IC-Acct-Perm-InActive value 4.
05 IC-Auto-Deposit-Last-Alloc-Dt Pic x(08)
05 IC-Flex-Account-Options Pic x(02)
88 IC-Recurr-Expense value '01'
88 IC-Copay-Rollover value '02'
05 IC-Request_Legnth Pic s9(04)COMP.
05 IC-Subscriber-Person-ID-R REDEFINES
IC-Subscriber-Person-ID Pic x(15)
10 IC-Plan-ID pic x(10)
10 IC-Plan-Status Pic x(01)
88 IC-Plan-New value '1'
88 IC-Plan-Active value '2'
*****Copybook2*****
05 RB-RB-Record-D PIC X(02)
Value'RB'.
05 RB-Employer-ID PIC X(09)
05 RB-Employee-ID PIC X(30)
05 RB-Details-Response-Code PIC X(09).
****Copybook3*****
Employee-Account-Record
05 RC-Employee-ID PIC X(02)
value'RC'
05 RC-Employer-ID PIC X(09)
05 RC-Employee-ID PIC X(30)
05 RC-Account-Type-Code PIC X(04)
05 RC-Plan-Start-Date PIC X(08)
05 RC-Plan-End-Date PIC X(08)
05 RC-Detail-Response-Code PIC(06)
Once defined above structure . I have to give input file as sequential data file and expected output as spreadsheet.
Thanks & Regards
Rao
-- modified at 18:57 Sunday 28th August, 2005
|
|
|
|
|
Hi,
I have to write a program to capture a usb barcode scanner,...
as you all know, when you scan a barcode, it acts like a keyboard & just sends the barcode text to the active window. all i have to do is just to write a program which runs in the background & captures those scanned barcodes to a text file and it would not sent it to the active window,.. it's like windows message intercepting for your own purpose.
i really apprecite if you can give me any sample code, or any clue.
Thanks in advance
|
|
|
|
|
You say it's acting like a keyboard, are you implying that it's using a generic Micorosoft Human Interface Driver?
/\ |_ E X E GG
|
|
|
|
|
yes i think so,
i didn't install any driver, by theway i have windows xp pro sp2.
it should be same as the usb keyboards.
|
|
|
|
|
Well then you can use some already documented APIs to interface with your device. I will post more details the open of business Monday.
/\ |_ E X E GG
|
|
|
|
|