|
As mentioned in your other post, just total and divide. What's wrong?
My guess is Counts != 60. But all you have to do is debug. Very simple.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I'm trying to convert some c# code that makes an API function call that has a parameter to a callback. I get a compiler error regarding the "Log" parameter in the call in the frmMain_Load function. How do I define things so that I satisfy the call to this function. Any help is greatly appreciated.
The c# code I'm trying to convert is:
public static IPublicClientApplication PublicClientApp { get; private set; }
static App()
{
PublicClientApp = PublicClientApplicationBuilder.Create(ClientId)
.WithB2CAuthority(AuthoritySignUpSignIn)
.WithLogging(Log, LogLevel.Verbose, false)
.Build();
}
private static void Log(LogLevel level, string message, bool containsPii)
{
string logs = ($"{level} {message}");
StringBuilder sb = new StringBuilder();
sb.Append(logs);
File.AppendAllText(System.Reflection.Assembly.GetExecutingAssembly().Location + ".msalLogs.txt", sb.ToString());
sb.Clear();
}
I've converted the code as follows:
Private Async Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PublicClientApp = PublicClientApplicationBuilder.Create(ClientId).WithB2CAuthority(AuthoritySignUpSignIn).WithLogging(Log, LogLevel.Verbose, False).Build
End Sub
Function Log(ByVal level As LogLevel, Message As String, ByVal containsPii As Boolean)
Dim logs As String = ($"{level} {Message}")
Dim sb As StringBuilder = New StringBuilder()
sb.Append(logs)
File.AppendAllText(System.Reflection.Assembly.GetExecutingAssembly().Location & ".msalLogs.txt", sb.ToString())
sb.Clear()
End Function
|
|
|
|
|
Try adding AddressOf :
PublicClientApp = PublicClientApplicationBuilder.Create(ClientId).WithB2CAuthority(AuthoritySignUpSignIn).WithLogging(AddressOf Log, LogLevel.Verbose, False).Build()
I don't like either version of the Log function - why does it create a StringBuilder , add one string, and then convert it back to a string? Unless there's other code in there which you haven't shown, you can just use:
private static void Log(LogLevel level, string message, bool containsPii)
{
string logs = $"{level} {message}";
File.AppendAllText(System.Reflection.Assembly.GetExecutingAssembly().Location + ".msalLogs.txt", logs);
}
Private Shared Sub Log(ByVal level As LogLevel, ByVal message As String, ByVal containsPii As Boolean)
Dim logs As String = $"{level} {message}"
File.AppendAllText(System.Reflection.Assembly.GetExecutingAssembly().Location + ".msalLogs.txt", logs)
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard. That solved it. Regarding the Stringbuilder, I simply used the online c# to vb.net code converter to get me started. I usually then go back and simplify. I knew the Log routine was insignifcant to problem I was having.
Sorry for posting in the wrong forum. I thought I had picked the VB.net forum. My Mistake. Thanks again.
|
|
|
|
|
I have upgraded my Visual Studio to 2019 but some of the statement can be ran on old version but failed in the new version of 2019 which is using crystal report as following :
Dim DA As New SqlDataAdapter(strsql2, Connection)
Dim DS As New DataSet
Dim strReportName As String
DA.Fill(DS)
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptDocument.Load(strReportPath)
rptDocument.SetDataSource(DS.Tables(0))
WHERE - The rptDocument.SetDataSource(DS.Tables(0)) is not working and always prompted with error of - Failed to load database information.
i spent days and so frustrated about this issue with no idea on how the error occurred, kindly please give me some advise, thx a lots......
Brs
George
|
|
|
|
|
Check the SQL command, and the dataconnectionstring. Try them both in a separate new project, or post those here.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hi guys, how would i do this pattern in VB?
thanks in advance
modified 11-May-20 14:03pm.
|
|
|
|
|
You have already, in the C# forum, been informed that homework assignments are for you to program. You have a programming assignment, not a "find-someone-who-can-do-the-work-for-me" assignment.
Now is the time for you to show your own coding attempts in both C# and VB, so we can see where you get stuck.
|
|
|
|
|
Hi,
I am developing a playout software using visual basic 2019. Now I need to capture the second screen of my computer and broadcast to youtube/twitch using stream keys or ip output. I've seen mediaplatform sdk, uniplays streamer, and srtstreamer. And i found obs studio at last. but it seems that there is no dll or api or whatever in vb.net. pls help me in this issue
Thanks in advance.
|
|
|
|
|
|
i installed obs separately and working well. but i want to integrate it into my application. Only two functions of OBS are required. Screen capture and stream settings.
|
|
|
|
|
I don't know what sort of response you expect here. You have to figure out how to use this product.
|
|
|
|
|
I would like to know how to fill the Parent table and multi different levels of child tables with data, mean the child tables will be filled with data relate to that Parent table only..
Example:
Level 1 : GRANDFATHER table - Can be fill using Data Adapter Like: (DataAdapter.Fill(DataSet.DataTable,GRANDFATHER-ID) - {(GRANDFATHER-ID is Primary Key)}
here i select specific record and fill and everything good
Level 2 : Father table - Can be fill using Data Adapter Like:(DataAdapter.Fill(DataSet.DataTable, MYGRANDFATHER-ID) - {(MYGRANDFATHER-ID is Foreign Key)}
mean here i can fill level 2 of child table because it is link to one record only from Parent table so I fill all fathers and one Grandfather, and still everything is good
Level 3 : Kids table - Here we face problem!! , How to Fill Data Adapter using multi Fathers ID?? mean i want to fill all kids under multi fathers related to that Parent table of one GRANDFATHER only..
I don not like to fill all Kids Data under all Fathers and All Grandfathers,
hopefully i found solution and clear what I mean...
|
|
|
|
|
Kids don't have multiple fathers; there can be only one.
The table-design is wrong, you don't want a table per generation. More simple, like;
SomeAutoId LONGINT,
ParentId LONGINT,
Name TEXT
The ParentId should point to the parent of the this record. The Id of this record in its own turn will be referenced from any children it has.
E.g.; you have a father (called father for simplicity) and two children (child1 and child2). The data would look like below;
SomeAutoId ParentId Name
1 NULL Father -- Here NULL is used as a parent,
-- because we don
2 1 EngrImad -- Here we point to record 1 in ParentId, as that is your father
3 2 Child1 -- ParentId pointing to the record with your name
23 2 Child2 -- Ditto as above; points to the record with SomeAutoId 2.
24 13 Chris -- not your child :)
1654 23 Grandchild1 -- first child of your second child. This way you can have an entire tree in a database, extend it easy without creating tables on the fly for generations.
That also makes populating the visual tree easier; you query your table for the root-nodes (parents without a ParentId). If that node opens, fetch the children of that node.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I suggest you dig more in Hierarchical term.
This is an example of visual basic .net winform project that uses MS-Access 2007 database and populate a TreeView control with all Data as [Parent->Child->GrandChild].
VB.NET Access 2007 Hierarchical TreeView[^]
|
|
|
|
|
VB.NET PLEASE
I would i be increasing a number(inside label) if a certain button is pressed. E.g if button5 is pressed the number will increase by 5 and if the button4 is pressed the number will increase by 4 till the number reach 50
|
|
|
|
|
OK ... and where do you stuck ?
Did you try anything until now ?
|
|
|
|
|
See my reply to your repost of this message in the Java forum.
|
|
|
|
|
I am writing a code in VBA that opens up all files in a document and copies and pastes the information from each document. User save to raw date report in path without open it, ( No one edit or modifiy Financial Number in Raw Date Download file) So I want to check each Workbook Date Created Time vs Date Modified Time both should match, then allow Copy and paste else show the Message box to user, File has been Modified, kindly revisit and download raw date" Here we can allow 20 minutes buffer time for downloading Report ie 24-Apr-2020 2.30 P.M vs 24-Apr-2020 2.50 P.M time will allow.
My code is below and any help or suggestion would be much appreciated. Thanks
Dim Ref As Object, CheckRefEnabled%
CheckRefEnabled = 0
With ThisWorkbook
For Each Ref In .VBProject.References
If Ref.Name = "Scripting" Then
CheckRefEnabled = 1
Exit For
End If
Next Ref
If CheckRefEnabled = 0 Then
.VBProject.References.AddFromGUID "{420B2830-E718-11CF-893D-00A0C9054228}", 1, 0
End If
End With
Dim objFSO As Scripting.FileSystemObject
Dim myFolder As Scripting.Folder
Dim myFile As Scripting.File
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set myFolder = objFSO.GetFolder("C:\ME Financial Report\")
For Each myFile In myFolder.Files
DCreated = myFile.DateCreated
DCreated = Strings.Format(myFile.DateCreated, "DD-MM-YY,HH:MM")
DModified = myFile.DateLastModified
DModified = Strings.Format(myFile.DateLastModified, "DD-MM-YY, HH:MM")
DModifiedAdd = DateAdd("n", 20, DModified)
DModifiedAdd = Strings.Format(DModifiedAdd, "DD-MM-YY, HH:MM")
Debug.Print DCreated, DModified, DModifiedAdd
If DCreated >= DModifiedAdd Then
MsgBox "File has been Modified, kindly revisit and download raw data - " & myFile, vbCritical
Exit Sub
Else
End If
Next myFile
|
|
|
|
|
|
Hi,
I'm starting to learn coding with vb .net and I'm having and issue while moving through registers using bindingnavigator. Let me explain:
I have a function (already tested and works fine) that receives an idNumber from a textbox and returns a file path.
If I call that function using
Private Sub BindingNavigatorMoveNextItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorMoveNextItem.Click
changeUser(usuarioTextBox.Text)
End Sub
it calls the function with the textbox data before moving to the next register, and that's not what I would like to do.
Any clues to solve this? Maybe I'm using and incorrect event?
Thanks in advance
|
|
|
|
|
What do you mean by "register"? It's not a common term in the context of VB. And the "navigator" is typically used to move position in a "set of records". Moving between "text boxes" is usually via the Tab key. You want to do something with text in a Text Box? It's usually done in response to a "button click"; e.g. to query or save something.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi,
Sorry for not using the right terms, I'm not familiar with them and got confused translating.
I'm using the navigator to move between records. What I was trying is to change a PictureBox Image every time the user moves using the navigator buttons. The path of the image is stored in db and contained in a textbox.
The problem I have is that using MoveNext event, I get the value of the textbox prior to move; so I don't get the right image path.
Thanks
|
|
|
|
|
Be aware that the movenext event MAY fire twice once on leaving a record and once on entering a record (I have not tested this but found it with other events). You may need to test the content of the object passed to the event.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I have service that is non-interactive that set values for these reg values, so that a computer can auto login:
AutoAdminLogon (1)
DefaultDomainName
DefaultUserName
Default Password
ForceAutoLogon (1)
This account automatically displays a form. When you click on a button, it will change the AutoAdminLogon and ForceAutoLogon reg values from a 1 to a 0, so a user can log in. After a minute if no one logs on, the reg values changes back from a 0 to a 1, so that it can automatically log back on, but it's not happening. I have a SCCM agent on the computer. If I push a script to run logoff.exe or a tsdiscon.exe, the autologin account will log back in. If I run the same commands from the service at the Ctrl + Alt + Delete screen, nothing happens. I do understand that because the service is non-interactive it won't work. Any suggestions on how to force the autologin account to log back on at the Ctrl + Alt + Delete screen? Thanks.
|
|
|
|