|
The normal way of doing this is to create a form that is called before you create the MainForm. If the user successfully logs in, then you do the Application.Run(new MainForm()) section.
Remember though, that you'll probably want to save the password encrypted, so your login code will need to check the encrypted versions.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
What part of creating a login window do you need help with?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi
I want to transmit a live video from server to multi clients using UDP, I m working in C# and I've captured the video from WebCam. So please tell me the steps to be follow to accomplish this task.OR if u have any tutorials or links related to my task plz Notify me.
Regards.
Shanzay
|
|
|
|
|
Hi all
Is it possible to change the screen resolution in c# (no DirectX!).
Also why is it that when creating a windows application in c# without the designer, along with your window you get a cmd window? Could someone post some code to get a simple window up without this!
Many thanks
|
|
|
|
|
|
Hi
I have a dataset containing multiple rows. Now I want to insert these rows at a stretch to database. Even though I'm using dataadapter.Update method, it's not updating or inserting any rows. Also, it is not giving me any error.
Anybody who knows please help. It's very urgent. Any url or link explaining the solution is also fine.
Thanks,
Meeram395
|
|
|
|
|
Did you specify InserttCommand property of the dataadapter?
|
|
|
|
|
Yes,
I have tried both InsertCommand and then Update command also. It's not giving any error. It is simply coming out of the loop, without inserting the rows to the database.
Meeram395
|
|
|
|
|
Hello friends,
I want to know, can we get the COM Port list (device attached to pc).
and the process name using the the COM port in C#.
Thanks in Advance.
Rahul Kulkarni
|
|
|
|
|
If you are using .NET 2, you can use:
string[] portNames = System.IO.Ports.SerialPort.GetPortNames(); If it's .NET 1/1.1 you will have to enumerate the registry entries at HKLM\Hardware\DeviceMap\SerialComm.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Firstly thanks for reply.
In that way we can get the com ports to which device are attached.
Now how can i get process name who r using these com ports. And which com port
is used by which process.
Thanks again.
rahul kulkarni
|
|
|
|
|
Hy there, I have a big problem(at least for me). I am trying to make some Controls that update themselves wery fast (even at 5 ms). It is for a game engine, but I want the users to make their game in the Form designer, this is why I derived the sprite from PictureBox.
My problem is that I will never be able to update the control from a separate thread (I mean i can but it's suicide) and from what I know every property\method call to a control translates to a SEND_MESSAGE or a POST_MESSAGE and this is processed in the UI thread. This is were all the other windows messages are processed, so when I start the update, the message queue gets filled with this updates and I'm not able to process other messages (resize, move window etc.). If I add an Application.DoEvents to the update, than the speed of the sprite will depend on what I am doing with the mouse\keyboard on the screen.
Can anyone help me with this problem?? I REALLY wan't to use controls for this game, but I am stuck Thank you
|
|
|
|
|
Hi,
If you want to update a control from another thread than the owning thread for that control use Invoke or BeginInvoke to have the owning thread execute the update of the control.
On a side note, to me it sounds like you have a much bigger problem than this. You mention that the message queue of the UI thread gets filled and doesn't respond to other messages anymore. That sounds like you're just processing you're whole engine in a tight loop causing the CPU load to go to 100%. I don't think it would matter much which thread is handling the messages since the controls need to be updated somehow.
It could also be that you're UI thread is just waiting for something else causing it to freeze (and not respond to any messages).
Hope that helps,
Mark
|
|
|
|
|
Well, this is exactly my problem, Invoke or BeginInvoke will not help me, because they will just make a safe-thread call, but the update will still be made on the UI thread. I think I need a way to make the update from another thread, but in a safe way. Let me tell you some details of my engine.
For now, my Sprite control is derived from PictureBox, adding some animation support, like interval and an OnUpdate event that it's set by the developer. For now, my Form only has an Threading.Timer thread that at 5 ms() calls a method for every sprite on the form, to make the Sprite check if the interval has passed, and to call the onupdate event. If I let the OnUpdate event empty, my app works fine, since it has nothing to add to the message queue. But if I add something to the event (for example I added an Opacity property to the Sprite and in the event, I say Opacity+=5), I'm not able to do much while the sprite is running, because the message queue is filled with this messages sent by the Sprite.
I'm starting to think that making a game engine from the designer its a bad ideea, but it would be so easy for the developer to visually set the Sprites behavior. Thank you
|
|
|
|
|
And what if you update the Opacity once every 10 calls to OnUpdate giving you 20 updates a second in stead of 200? I can imagine that trying to change the opacity of a control 200 times a second might be a bit much. And I don't think you would see much difference anyway. My screen doesn't refresh itself at 200Hz the last time I checked.
Mark
|
|
|
|
|
I understand that, but imagine that a game doesn't have only one Sprite, I could add for ex 10 Sprites. What do i do then? I really wan't to make this game engine visually(like Flash). I think that my problem is that I need to set priorities to the messages sent to the message queue, for example the
click\resize\move etc.. , I mean all the messages that are sent by windows to the Form to be processed
before the control messages. Do you have any ideea how I can do that in C#? something like override WndProc or make my own custom message queue??
|
|
|
|
|
I can't help you with setting priorities to messages. But I doubt you're going the right course with that anyway.
I think another solution would be to use timeSetEvent/timeKillEvent as mentioned by Luc and just use one for each control. But don't have it fire off periodically unless needed. So if you're sprite is idle, don't fire off any timers. If you're sprite is moving, have a timer tick at a reasonable interval until you're sprite is done moving. This way no unnecessary events will need to be processed.
I'm not sure how windows likes it if you have a massif amount of sprites with timers, but I guess you don't need to worry about that right now.
Another solution might be to have one timer (again with a reasonable interval), which basically is you refresh all event. On that event you can check the position and shape of all controls and redraw them in one go. This will probably generate quite some messages at that time, but probably a lot less compared to having a tick every 5ms.
|
|
|
|
|
Hi,
I have several comments:
1.
You can ask a timer to tick every 5 msec, that does not mean it will do that. Read my
timer article!
2.
If you use a Windows.Forms.Timer you will get ticks on the UI thread automatically,
saving half of the messages and avoiding the need for an explicit Invoke()
3.
PictureBox is not my favorite Control, it has limited functionality and unknown overhead.
4.
I guess your painting action is too expensive; I would suggest to optimise the paint
action, possibly by reducing the number of controls. In general the lightweight approach
gives the maximum performance, in its extreme form it means ypu use one Control (a Panel),
do all keyboard/mouse event dispatching yourself, and organize the paint event yourself,
carefully watching the invalidate region. IMO just adding lots of Controls is not the right
way to create a game.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
i have 3 seesons in my database ,Morning Evening, And Afternoon.they are checkboxin database means YES/NO...........I have a datagrid inthat i have a field like Session
In session column i want to retrieve data from database according to the data in DB.
if morning and evening is checked it shows like MORNING,EVENING
Please help me regarding this issue?
|
|
|
|
|
Have you figured this out yet? You may want to try using stored procedures to return MORNING,EVENING to the datagrid...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
how to storing instance of object in a class?
|
|
|
|
|
Create a class-level variable of the type of object you want to store.
If necessary, add property get/set accessors to your class to retrieve/update your object.
Paul
|
|
|
|
|
In Collection, Hashtable, ArrayList
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Hi,
In my DataGridView component there are two columns that have to be transparent when they are selected. Becouse these cells are CheckBox cells and their backgorund colors are important, I want that background color will be visible when they are selected.
The problem is while they are selected, if I minimize program to taskbar and maximize again, these cells background color remain same with the desktop. After changing selection they are repainted and become normal. Also at first run, the same problem occurs.
Do you have any solution or idea?
Thanks.
|
|
|
|
|
Hello,
I have created a DLL(C# CODE) with
signed key , com visibility is true and registered it with regasm but still when i try to use it in ASP page by calling server.createobject() i can not use.
I tried posted this on other section /net frame work, but there was no reply.
Hope this section provides some guidelines
Please suggest.
Pavas
Pavas
|
|
|
|