|
Thanks - yes - you are right. I will see if I can edit the link away. If people are interested they can google it themselves!
The Application.DoEvents are not in my final version - I should have removed them before I posted. I often use those to host a breakpoint for convenient place to examine values. Yes - I do occasionally leave them accidentally so I would agree, that remains in the dumb category. However, I do find the occasional DoEvents necessary in some synchronously running tight loops.
I thought an async function should always return a value and some examples from which I learned a long time ago have that task(of task) with the return of task.completedtask. Wow - that is all over my code...
|
|
|
|
|
Dan Desjardins wrote: I thought an async function should always return a value
Perhaps you were confused by the valid "avoid async void" warning - in VB.NET, that would be the equivalent of an Async Sub :
Avoid async void methods | You’ve Been Haacked[^]
An Async Function that returns a non-generic Task is similar to a synchronous Sub that doesn't return anything. An Async Function that returns Task(Of Foo) is similar to a synchronous Function that returns Foo .
In other words:
Sub PrintSync()
...
End Sub
PrintSync() would become:
Async Function PrintAsync() As Task
...
End Function
Await PrintAsync()
And:
Function CalculateSync() As Integer
...
Return 42
End Function
Dim i As Integer = CalculateSync() would become:
Async Function CalculateAsync() As Task(Of Integer)
...
Return 42
End Function
Dim i As Integer = Await CalculateAsync()
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
And now that makes sense to me - especially since your return int is 42
|
|
|
|
|
I want to know some coding for attaching attendance machine's IP Connected or Disconnected. I have a sample image for it.
|
|
|
|
|
Then ask the manufacturer for the sample code.
Even if we knew the make and model of the machine you're using, nobody here is going to do your work for you. All we could do is Google for sample code and give you the links - something you could easily do for yourself.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Ask the manufacturer, they know the capabilities of their device.
|
|
|
|
|
Attendance controls?
That's more expensive than missing a few days from a few of your top devs
To ridicule it more; in the age of working from home? If it is a truck driver, then there's cheaper ideas, they just need to register starting time and end time (yup, done that, been there).
This only a benefit in a supermarket. Are you a supermarket?
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.
|
|
|
|
|
Ping the IP address.
"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
|
|
|
|
|
418
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.
|
|
|
|
|
Currently I am working on an old VB6 app to be compatible with UNICODE.
This app has SSTab and within this tab, there are user control q1, q2, q3 and so on. For q1, it has the following code:
Private WithEvents q1 As VBControlExtender
Private progID As String
procId = "ALCTX10.CTX10.1"
Set q1 = Controls.Add(procId, "q1")
myTab.tab = 1
q1.Move borderSize, topMargin, myTab.Width - borderSize * 2, _
myTab.Height - borderSize - topMargin
q1.Visible = True
The procId is referring to VC++ 6 DLL. All user controls are using this DLL.
For VC++ 6 DLL, I added ",_UNICODE, UNICODE" into the preprocessor definitions under the project setting of VC++ 6.
And compiled the DLL again and then brought it back to VB6.
The problem is I am still getting the same UNICODE issue from VB6 app.
I am using a foreign version of Windows XP so it is not the font problem.
I can’t just replace this DLL with UNICODE supported TextBox or RichTextBox since there are too many things going underneath the DLL.
I would appreciate very much if anyone sheds a light on this problem. Thanks.
|
|
|
|
|
You have atready asked it in VC++/MFC forum.
|
|
|
|
|
Yes. But I posted it here also since the main app is VB6 even though the DLL is VC++ 6.
|
|
|
|
|
Ok, let me try to explain my dilemma. I have a VBApp that I can't republish due to another issue, but the crystal report in the app, that is published on our server needs a very minor tweak.
When published, where is the .rpt file put? I'd like to just change the .rpt file with the modification we need without republishing.
I found config data in the c:\users\nameofuser\appdata\local\apps\2.0\data directory, but no sign of where the .rpt file gets put.
Any idea where VS.Net puts this?
Lost in the vast sea of .NET
modified 27-Oct-22 13:06pm.
|
|
|
|
|
There won't be a standard location. If it's not within the published application folder, then you'll need to check the code to see where it loads the reports from.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello every one;
the below Code is to update Parent and Child table,
the relationship between tables was set to (Relation only) on Data Designer,
But on SQL Server, Update and Delete Rule set to (Cascade)
with this setup Parent table was Updating ok,
but child table return (Added/Modified) changes as nothing and did not get update
I tried all cases to Set (Update-Delete-Accept/Reject) relationship Rules On Dataset Designer but did not solve the issue
Could advise what to do here
thanks in advance
ParentTableBindingSource.EndEdit
Dim My_Parent_Modified As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Modified)
Dim My_Parent_Added As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Added)
Dim My_Parent_Deleted As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Deleted)
If My_Parent_ Modified Is Nothing = False Then
End if
If My_Parent_ Added Is Nothing = False Then
End if
If My_Parent_Deleted Is Nothing = False Then
End if
DataSet1.ParentTable.AcceptChanges
ChildTableBindingSource.EndEdit
Dim My_Child_Modified As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Modified)
Dim My_Child_Added As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Added)
Dim My_Child_Deleted As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Deleted)
If My_Child_ Modified Is Nothing = False Then
End if
If My_Child_ Added Is Nothing = False Then
End if
If My_Child_Deleted Is Nothing = False Then
End if
DataSet1.ChildTable.AcceptChanges
Imad
modified 27-Oct-22 7:02am.
|
|
|
|
|
|
Sorry Confused already delete fronm there
|
|
|
|
|
I want to add "wake the computer to run this task" scheduled task in condition tab in vbscript
|
|
|
|
|
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:
Imports MySql.Data
Imports MySql.Data.Entity
Imports MySql.Data.MySqlClient
Imports MySql.Data.Types
Public solde_operation As Integer = 0
Public MaxId As Integer
Public j As Integer
Public soldecaisse As Integer
Public i As MySqlParameter
Private Sub GetMaxId()
connecter()
Dim sql As String
sql = "(SELECT MAX(Id_operation) FROM tbl_operation)"
Dim query As New MySqlCommand()
query = New MySqlCommand(sql, connecter)
MaxId = Val(query.ExecuteScalar())
connecter.close()
End Sub
Private Sub GetSoldeCaisse()
connecter()
Dim sql As String
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 As New MySqlCommand()
query = New MySqlCommand(sql, connecter)
i = New MySqlParameter("@i", j)
soldecaisse = Val(query.ExecuteScalar())
connecter.close()
End Sub
Private Sub UpdateSolde()
connecter()
GetMaxId()
Dim sql As String
sql = "UPDATE tbl_operation SET Solde_operation = soldecaisse WHERE Id_operation = @i"
i = New MySqlParameter("@i", j)
Dim query As New MySqlCommand()
For j = Val(txt_num_operation.Text) To MaxId
GetSoldeCaisse()
query = New MySqlCommand(sql, connecter)
Next
connecter.close()
End Sub
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…
|
|
|
|
|
This is an English speaking site. Modify your question and replace your French text with English.
|
|
|
|
|
Google translate: 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:
[CODE]
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.
|
|
|
|
|
hello all
how build a dns server software by vb.net
|
|
|
|
|
Well, you start by reading the entirety of RFCs 1034[^] and 1035[^] and completely understand all of it before you start thinking of writing code.
Oh, and I hope you're well skilled in writing TCP servers, and creating your own database to store the record data.
|
|
|
|