For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Problème de mise à jour liée aux élément interdépendants de ma table
Bonjour chers membres du forum, j’ai une préoccupation qui est liée à la mise à jour de ma table.
En effet j’ai conçu une application vb.net pour la gestion des opérations de caisse pour le compte
d’une structure et tout fonctionne correctement jusqu’au niveau de la modification de la table où j’ai un bémol.
Le truc c’est qu’une opération est soit une recette ou une dépense d’où j’ai créé une variable
solde = recette - dépense (recette ou dépense est nulle selon la nature de l’opération) qui représente le solde
de chaque opération effectuée.
Pour ce qui est de la part du solde de la caisse à partir d’une opération op2 on a:
E: solde_caisse_op2 = solde_op2 + solde_caisse_op1 ( égal à solde_op1) et cela fonctionne bien en insertion.
Mon problème est que sur par exemple 10 opérations effectuées on décide de modifier la 5ème opération,
comment réajuster le solde de la caisse à partir de la ligne modifiée jusqu’au dernier élément de la table
solde_caisse, vu que les différentes lignes sont dépendantes pour le calcul des différentes soldes
de la caisse d’après l’équation E.
J’ai déjà réfléchi à une solution mais qui me donne une FatalError. En effet j’ai procédé comme suit:
Public solde_operation AsInteger = 0Public MaxId AsIntegerPublic j AsIntegerPublic soldecaisse AsIntegerPublic i As MySqlParameter
'La méthode GetMaxId() me ramène Id_max stocké dans la variable MaxId qui me servira de 'condition d'arrêt de la boucle forPrivateSub GetMaxId()
Dim sql AsString
sql = "(SELECT MAX(Id_operation) FROM tbl_operation)"Dim query AsNew MySqlCommand()
query = New MySqlCommand(sql, connecter)
MaxId = Val(query.ExecuteScalar())
EndSub'celle-ci me calcule le solde de la caisse au cours de l'opération en cours (soldecaisse) en y 'ajoutant le solde de la caisse précédentPrivateSub GetSoldeCaisse()
Dim sql AsString
sql = "select ((select Solde_operation from tbl_operation where Id_operation = @i) + (select Solde_operation from tbl_operation where Id_operation = @i-1))"Dim query AsNew MySqlCommand()
query = New MySqlCommand(sql, connecter)
i = New MySqlParameter("@i", j)
soldecaisse = Val(query.ExecuteScalar())
EndSub'et enfin cette dernière qui fera la mise à jour en remplaçant chaque solde par soldecaisse 'selon la variation de j dans la boucle for.'la mis à jour commence donc à partir de la ligne modifiée jusqu'au dernier élément de la 'colonne puisqu'ils sont liés.PrivateSub UpdateSolde()
Dim sql AsString
sql = "UPDATE tbl_operation SET Solde_operation = soldecaisse WHERE Id_operation = @i"
i = New MySqlParameter("@i", j)
Dim query AsNew MySqlCommand()
For j = Val(txt_num_operation.Text) To MaxId
GetSoldeCaisse() 'appel de la methode qui retourne le solde de la caisse
query = New MySqlCommand(sql, connecter)
En résumé la méthode GetMaxId() lors de son appel renvoie l'id_max de la table opération et cette valeur servira
de condition d'arrêt dans la boucle.
Ensuite la méthode GetSoldeCaisse(), quant à elle calcule le solde de la caisse au cours d'une opération donnée.
Enfin, la méthode UpdateSolde() qui sera appelée juste après celle qui effectuera la modification de la ligne
concernée, nous recalcule le solde de la caisse à partir de la ligne modifiée jusqu'au dernier élément de la colonne
car tous liés. La boucle for définit le début et la fin des modifications.
Je compte sur chacun pour la résolution de cette difficulté. Merci…
Hello dear forum members, I have a concern that is related to updating my table.
Indeed I designed a vb.net application for the management of cash operations for the account
of a structure and everything works correctly until the level of the modification of the table where I have a problem.
The thing is that an operation is either a receipt or an expense from which I created a variable
balance = revenue - expenditure (revenue or expenditure is nil depending on the nature of the operation) which represents the balance
of each operation performed.
As for the part of the cash balance from an op2 operation, we have:
E: balance_caisse_op2 = balance_op2 + balance_caisse_op1 (equal to balance_op1) and it works well in insertion.
My problem is that on for example 10 operations carried out we decide to modify the 5th operation,
how to readjust cash register balance from changed row to last item in table
cash_balance, since the different lines are dependent for the calculation of the different balances
of the body according to equation E.
I have already thought of a solution but that gives me a FatalError. I actually did the following:
In summary, the GetMaxId() method when called returns the id_max of the operation table and this value will be used
stop condition in the loop.
Then the GetBalanceCaisse() method, for its part, calculates the balance of the cashbox during a given operation.
Finally, the UpdateBalance() method which will be called just after the one which will modify the line
concerned, we recalculate the balance of the cash register from the modified line to the last element of the column
because all related. The for loop defines the start and end of changes.
I am counting on everyone to resolve this difficulty. Thanks…
From your description, it sounds like you're trying to build some sort of running total. But looking at your code, it's not clear how you're doing that, nor what the problem is.
Start by describing your table structure and providing some sample data. Then explain what you're updating, and what you want to happen when you update it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Deshalb speichern wir keine laufende Summe; es ist die Summe aller Datensätze in der Datenbank zu diesem Zeitpunkt. Sie speichern es nie, Sie berechnen es. Es ist nicht so dass es Jahre dauern wird. Schauen Sie sich auch das Erinnerungsmuster (memento-pattern) an.
And no, if you don't speak English, why would I bother to translate?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
No, I'm dead serious. You either understand the entire spec or you're writing a server that doesn't work with clients.
You have no idea how much work is going to go into this project. It's not something you're going to bang out in couple of weekends, and you're not going to get description of how to do it in a forum environment where that description would take a three volume set of books to write.
You think telling someone to read the "spec", when they obviously haven't, is "harsh"?
How can you share a vocabulary when only one part speaks the language?
I'm ecstatic when there is a spec and I don't have to rely on someone's say-so or interpretation.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
In the click handler, you have the sender argument, correct? Put code into the click handler that casts the sender argument to a button object and grabs its Text property. And set every button to use that one click handler.
The difficult we do right away...
...the impossible takes slightly longer.
I have a service that will perform some kind of action depending on what the SessionChangeDescription is. The service is installed on a computer that autologs in. To make this happen this registry value needs to be set and is set during OnStart:
Key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
There is a Windows Form that will allow a domain user to log in and the service will change the AutoAdminLogon value to a 0. When a power outage occurs and power is restored the PC, the computer does not autologon cause the registry value AutoAdminLogon is not set back to a 1 yet. I normally just send a logoff, tsdiscon, or restart to the computer through SCCM and it will autolog again. These are my questions:
1. Is it possible to logoff or disconnect a session through the service at a logon screen?
2. Is it possible to trigger one of the SessionChangeDescription without any session changes?
3. Restart the computer through the service?
What I have tried:
At OnStart, get the AutoAdminLogon value and if it a 0, then do one of these:
ExitWindowsEx function, WTSDisconnectSession function, wmi to logoff a session, tsdiscon.exe, logoff.exe, shutdown.exe, and LockWorkstation function.
None of them work. If I do the same through SCCM, the computer autologs in.
Nevermind. Looks like I guessed a bunch of times and was able to figure it out. Even though in SCCM, I only use tsdiscon and the account used is the SYSTEM account, it works. It doesn't apply in this scenario. Using tsdiscon 1 (Session 1) works or WTSDisconnectSession function with a 1 for Session 1 also works.
Visual Studio has nothing to do with this. The limits of the controls are imposed by the control libraries in Windows and .NET.
Why on earth would you put a million items in a ListBox, or any other control for that matter? It'll take forever to populate unless you use "virtual mode", and, as a user, would you want to navigate through all that? Of course not! So why would ever do this?
@Dave Kreskowiak, Why on earth would you not want to know the actual limits on controls? Microsoft has wrongly stated constraints in the past and it would take forever to find out if they were right or wrong if no one ever tested them. Wrong about the virtual mode. It did not take forever to populate. It was fast. Why assume that virtual mode would be the default avenue of effort? Of course I did not use virtual mode. That would have been a waste of time. Is that how you personally would do testing? Why would you even think of using virtual mode? Is that how you think? Are you so boxed into virtual mode that you assume it?
Why would you never test the limits of Visual Studio?
How would a mechanical engineer know the strain hardening within the stress/strain curve (Young's modulus) of various materials if no one ever tested such?
How would an aeronautical engineer know the travel of the shock-fit across the surface of a supersonic Joukowsky airfoil at various speeds if no one ever tested it?
How would an electrical engineer know that at ultra-high voltage the electrons leave the man-made electrical conducter and follow a plasmatic cloud self-created by those electrons if no one ever tested it?
Think before you answer! At least think before you answer me.
To test, of course. An Aeronautical, or Civil, or Electrical, or Electronic, or Mechanical, or Structural engineer would know that. I would guess that even a Systems Engineer would do testing, but I may be wrong.
I did not ask for your opinion on Visual Studio. I asked who noticed this capacity. You did not even answer the question. You went on a tangent.
Please allow people that, "noticed this capacity" to answer the question.
I never said testing the limits of the controls was irrelevant. Those are technical limits. Using the controls is subject to the usability limits of users. Sure, you can put a million items in a listbox. Now what?
Putting a million items in a control is putting your users through navigation hell. Are you seriously going to expect users to search through that many items to find the one, or more, they want? If you don't code for the limits of your users, they uninstall your app.
Technical limits are only one aspect of the "limits" you should be concerned about.
@Dave Kreskowiak, your wisdom about focusing on users I accept.
I explained in a different reply (to Gerry Schmitz) in this thread why I wanted the sort and what I had discovered.
The list and the sort would not necessarily be for the user to see, but for my internal use. And, by using a list box sort I did not have to include a sort of my own in code and could keep the final file size smaller. Microsoft has some very nice code already written that behind the scenes does some amazing things fast. I used their years of experience and army of coders to speed up my program and lessen the final size of it.
But, I was still left with the question of "How did they do that?" So, now I am attempting to devour C and C++ as fast and as thoroughly as I can. Read, study, code, try not to pull out hair, ask here, repeat.
Last Visit: 31-Dec-99 18:00 Last Update: 27-Sep-22 12:09