|
Hi Benjamin.
I did something similar to this in Visual Basic using windows functions (DLL) in those days. I called it broadcast.
However, your issue is not very difficult because those clients that are online receive your message, but anyone just connecting will not receive it after the broadcast.
What you have to do is to store and forward your messages for the clients that are offline. You can achieve this by storing your message and client ID on a database or a file for the clients that are online at the time of sending message out, then you will have a sort of service program that will forward the message later for new clients just connecting to the network.
Remember every system has a unique computer name (ID) on windows network.
When you send the message out, you keep the IDs of those online and the service program will later forward to new online clients and store their IDs too.
Note that you may also have to generate unique message ID also to filter.
|
|
|
|
|
Hello everyone, I have the following problem. It happens that I sent some data through TCP and I receive it, but it happens that this data is all added in a single column.
Public Function Rutina()
Do
If Ejecuto = True Then
Exit Do
End If
If TCP.Pending = True Then
TCPSERVERCLI.Client = TCP.AcceptSocket
End If
If TCPSERVERCLI.Connected = True Then
If TCPSERVERCLI.Available > 0 Then
Dim DataBytes(1000) As Byte
Dim decode As New ASCIIEncoding
TCPSERVERCLI.Client.Receive(DataBytes)
Me.LNetgames.Items.Add(decode.GetString(DataBytes))
End If
End If
Loop
End Function
https://i.postimg.cc/hvkHf8V7/Screenshot-1.png
|
|
|
|
|
Because that's precisely what you've told it to do!
You need to split the string and add the elements to the columns:
Dim line As String = decode.GetString(DataBytes)
Dim parts() As String = line.Split("|"c)
Dim item As New ListViewItem()
item.Text = parts(0)
For i As Integer = 1 To parts.Length - 1
item.Subitems.Add(parts(i))
Next
Me.LNetgames.Items.Add(item)
NB: According to your screenshot, your text starts with the | character. You may need to adjust the indices on the array to skip the blank first element:
item.Text = parts(1)
For i As Integer = 2 To parts.Length - 1
...
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thank you very much it helped me thank you for your help
|
|
|
|
|
Is it possible to extract information from pdf document with vb6?
Thank you very much in advance
|
|
|
|
|
VB6? Why? It's been dead for over 20 years now. If you're starting new development in VB6, you really need to rethink that.
If you insist on using it, you're going to have to do some research into finding a PDF library that is exposed through COM. I don't know of any straight away.
If you switch to VB.NET (which is FREE with the Visual Studio Community Edition!), you can use any of today's libraries, like PDFSharp.
|
|
|
|
|
Unfortunately I need it for vb6. I know the version is outdated, but it's the one I need right now. The next step is to develop in nodejs. This is now just a pilot project.
|
|
|
|
|
Well, you're going to have to start looking for a PDF library that you can access through COM support.
|
|
|
|
|
|
|
Story:
I have a ListBox where I add custom objects, when the user clicks these custom objects in that ListBox some WPF Controls are generated in a stackpanel, these WPF Controls are properties of the custom objects. Below you may see the class.
<pre> Public Class VariableClass
Public Property Content As String
Public Property myNameLabel As New Label
Public Property myNameTextBox As New ComboBox
Public Property myTypeLabel As New Label
Public Property myTypeTextBox As New ComboBox
Public Overrides Function ToString() As String
Return Content.ToString()
End Function
End Class
I want to know what PropertyName the control the user types into has.
<pre> Private Sub ValuePanel_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles ValuePanel.PreviewKeyDown
Dim myElement As ComboBox = e.OriginalSource.TemplatedParent
Dim myVar = GetValue(myElement).GetType().GetProperty("PropertyName")
End Sub
However myElement is not a DependencyObject and cannot be cast to one, I don't know how else to get the PropertyName or the VariableName.
|
|
|
|
|
|
Hello and thanks in advance.
I have created a form1 which is asking for a password to get to form2. After you put in your code and click on the submit button it looks at an access database table for that code, if code exists it then returns by closing form1 and shows form2.
In the access database there are 2 fields, username and password. how can I show on form2 in a text box the username which was approved to sign on in a textbox?
|
|
|
|
|
|
Thank you for the quick reply. I am trying to understand this, sorry. So I have in my button the following. So when I get to form2 (Form2.Show) how would I pull out the username from the MDB file.
Dim connab As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\test\1274-Users.accdb")
REM Dim cmd As New OleDbCommand("select* from login1 where user1=@userl and pass1=@pass1", connab)
Dim cmd As New OleDbCommand("select* from login1 where pass1=@pass1", connab)
REM cmd.Parameters.Add("@userl", OleDbType.VarChar).Value = TextBox1.Text
cmd.Parameters.Add("@pass1", OleDbType.VarChar).Value = TextBox2.Text
Dim adapter1 As New OleDbDataAdapter(cmd)
Dim table As New DataTable
adapter1.Fill(table)
If table.Rows.Count <= 0 Then
MsgBox("ERROR: NO PASSWORD OR INCORRECT PASSWORD")
TextBox2.Text = ""
Else
TextBox2.Text = ""
Form2.Show()
Me.Visible = False
|
|
|
|
|
The data from the database record should be in the DataTable. Use your debugger to examine the results after the Fill operation.
|
|
|
|
|
Jeremy Haley 2022 wrote: In the access database there are 2 fields, username and password.
Sounds like you're storing the passwords insecurely.
Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]
NB: If you trust everyone who can access the database file not to look at the table to see the passwords, then why bother with a password in the first place? Just let them pick from a drop-down list of usernames.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i have code to combine two datatable.
the code works fine in my test program, but when i copy it to my production program it gives me this error?
"{"Specified cast is not valid."}"
here is the code and the error is in the for each loop.
<pre> Private Sub CompareDataTables(ByVal dt1 As DataTable, ByVal dt2 As DataTable)
Try
Dim Results =
(
From table1 In dt1
Join table2 In dt2 On table1.Field(Of Integer)(0) Equals table2.Field(Of Integer)(0)
Where table1.Field(Of String)(1) <> table2.Field(Of String)(1) OrElse
table1.Field(Of String)(2) <> table2.Field(Of String)(2)
Select table2)
For Each row As DataRow In Results
DataGridView3.Rows.Add(row.ItemArray)
Next
dtNew = Results
Catch ex As Exception
ErrorHandler.ErrHandler("CompareDataTables- Import_Customer")
End Try
End Sub
i have search the net for two days and can't fine the solution. can some one help me please!!!
|
|
|
|
|
Either the first column of both tables is not an Integer , or the second or third columns of both tables is not a String .
We have no access to your data, so we can't tell you where the problem is. You need to debug your code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you i think i know what i did wrong.
need to check a few things to make Sher.
|
|
|
|
|
Hi my guy.
Whichever language you are using in Visual Studio, this will work as long as the two datatables have the same schema/structure.
//=====================See Code Below =================================
DataTable DT1 = TicketDatatable();
DataTable DT2 = TicketDatatable();
DT2.Merge(DT1); //This combines the two datatables provided they have the same attributes (Schema)
//======================================Code Above =======================
DT2 is now the combined datatables, using the merge method of datatable.
|
|
|
|
|
I have written a Check Book application and the code that calculates the 4th Tue of the Month is failing when we enter a new Year. I have added an additional Function that works but the code seems less tan elegant. I have tested a few changes with no results.
Without posting a lot of unnecessary code here is the process and the relevant code that works now.
I am storing he 4th Tue of the month in a SQLite DB and when the user writes a check I am testing if the date today is greater than the stored DB date. If this test is true than I update the stored date to the 4th Tue for next Month. I would like to know if there is a better way to design this process ?
Perhaps only using one Function.
Public Sub GetDateInfo()
Using conn As New SQLiteConnection($"Data Source = '{gv_dbName}';Version=3;")
conn.Open()
Using cmd As SQLiteCommand = New SQLiteCommand($"SELECT * FROM DateInfoTable WHERE DID = '1'", conn)
Using rdr As SQLite.SQLiteDataReader = cmd.ExecuteReader
While rdr.Read()
varSearchDate = CDate(rdr("diTESTdate"))
End While
End Using
End Using
End Using
End Sub
This is the code that executes when user writes a check
Public Sub testDates()
GetDateInfo()
'Other Option
'ElseIf dateToday > varSearchDate And CInt(varSearchDate.ToString.Substring(0, 2)) = 12 Then
'============================================================================================
Dim dateToday = Date.Today
Dim mo As String
mo = dateToday.ToString("MM")
'mo = varSearchDate.ToString("MM")
'line above for testing for NOV
If dateToday > varSearchDate And CInt(mo) <> 12 Then
varFTue = CDate(FourthTueOfNextMonth(Date.Today).ToString("yyyy-M-d"))
WriteNewFourthTue()
gvTxType = "SS Deposit"
ElseIf dateToday > varSearchDate And CInt(mo) = 12 Then
varFTue = CDate(FourthTueOfNewYear(Date.Today).ToString("yyyy-M-d"))
MsgBox("varFTue " & varFTue)
WriteNewFourthTue()
gvTxType = "SS Deposit"
End If
End Sub
These are the two Functions that are in a Data Module
Function FourthTueOfNextMonth(dt As Date) As Date
Dim currDate = New Date(dt.Year, dt.Month, 1)
Dim nTuesday As Integer
While nTuesday < 4
If currDate.DayOfWeek = DayOfWeek.Tuesday Then
nTuesday += 1
End If
currDate = currDate.AddDays(1)
End While
Return New Date(dt.Year, dt.Month, currDate.Day - 1)
End Function
Function FourthTueOfNewYear(dt As Date) As Date
Dim currDate = New Date(dt.Year + 1, dt.Month - 11, 1)
Dim nTuesday As Integer
While nTuesday < 4
If currDate.DayOfWeek = DayOfWeek.Tuesday Then
nTuesday += 1
End If
currDate = currDate.AddDays(1)
End While
Return New Date(dt.Year + 1, dt.Month - 11, currDate.Day - 1)
End Function
|
|
|
|
|
If the "day" of the "Tuesday date" is >= 22 and <= 28, it's the 4th Tuesday.
How to: Extract the Day of the Week from a Specific Date | Microsoft Docs
"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
|
|
|
|
|
Gerry I like the idea. Guess I was being exact with the date for each month in case the user does not write a check between the date range. With the exact date from the database if the user writes a check after the 28 of last month the the event will trigger in the next month. I was trying to avoid having two Function and find a better way to write a test that would capture the 4th Tue when the YEAR changes.
I appreciate the link to working with Date's Date's are like a moving target that always needs to go back to the starting point January
|
|
|
|
|
Use date add with 3 weeks and add weekday difference with it you will get the fourth Tuesday
Every thing is possible
|
|
|
|