|
|
I remember the Turkish problem, but I keep using lower case for some reason thinking the opposite.
And didn't know about Hashset, never heard of it. But just gave it a whirl and it solves my case/turkish issue.
I read the post in the lounge on the one liner, and was kind of surprised. I'm not really sure where I got it from. It was sort of Deja Vue in which I thought I wrote it a couple of days ago and was just trying to remember what I wrote.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I have used https://www.codeproject.com/Articles/1113626/Adding-the-Missing-Real-Time-Clock-to-Windows-IoT to get 2 functions to convert int to bcd and vice versa. As I use Visual Basic I converted them, but the functions don't seem to create the right output. Please advise.
static int BcdToInt(byte bcd)
{
int retVal = (bcd & 0xF) + ((bcd >> 4) * 10);
return retVal;
}
Private Shared Function bcdToInt(bcd As Byte)
Dim retVal As Integer = (bcd And &HF) + ((bcd >> 4) * 10)
Return retVal
End Function
static byte IntToBcd(int v)
{
var retVal =(byte)( (v % 10) | (v / 10) << 0x4);
return retVal;
}
Private Shared Function intToBcd(v As Integer)
Dim retVal As Byte = (v Mod 10) Or ((v / 10) << 4)
Return retVal
End Function
modified 16-Feb-21 5:27am.
|
|
|
|
|
It would help if you provided the details of the error you're getting.
Based on a quick test, you're getting an overflow exception when you call intToBcd(239) . Change the function to:
Private Shared Function intToBcd(v As Integer)
Dim retVal As Byte = ((v Mod 10) Or ((v \ 10) << 4)) And &HFF
Return retVal
End Function With that change in place, the C# and VB.NET functions appear to return the same values for the same inputs.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
There is no error. The data are just incorrect.
Your changes work beautifully. Thanks!
|
|
|
|
|
Incorrect results are an error.
In this case, since the input domain was small enough, it was fairly trivial to run through every possible input. But in future, you should provide an example of the input(s), expected output, and actual output where the results are wrong.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello, how do I delete a file from my computer that has already been sent to an email?
Imports System.IO
Imports System.Net.Mail
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim compInfo = "computerInfo.txt"
Try
Dim MailMessage As New MailMessage()
MailMessage.From = New MailAddress("@gmail.com")
MailMessage.To.Add("@gmail.com")
MailMessage.Attachments.Add(New System.Net.Mail.Attachment(compInfo))
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("@gmail.com", "pass")
SMTPServer.EnableSsl = True
Catch
End Try
If System.IO.File.Exists(compInfo) = True Then
System.IO.File.Delete(compInfo)
End If
End Sub
The problem appears in:
System.IO.File.Delete(compInfo)
"The process cannot access the C:\...\...\computerInfo.txt file because it is being used by another process"
|
|
|
|
|
The message you got says exactly what the problem is : another part of your Application or another Application is allready using the File you want to delete. In this case your OS itself prevents that you can delete this file.
So ... from where does this file come from and is it necessary that the file is still opened ?
This answer could not come from us - it must come from you ...!!!
|
|
|
|
|
Your code snippet doesn't send the email, but just adding the file as an attachment seems to keep the file locked until either the email and all attachments have been uploaded to the SmtpServer or the Attachment object has been Disposed.
|
|
|
|
|
As Dave said, you need to dispose of the message after you've sent it:
Using message As New MailMessage()
message.From = New MailAddress("@gmail.com")
message.To.Add("@gmail.com")
message.Attachments.Add(New System.Net.Mail.Attachment(compInfo))
Dim smtp As New SmtpClient("smtp.gmail.com")
smtp.Port = 587
smtp.Credentials = New System.Net.NetworkCredential("@gmail.com", "pass")
smtp.EnableSsl = True
smtp.Send(message)
End Using
If IO.File.Exists(compInfo) Then
IO.File.Delete(compInfo)
End If
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello!
I integrated wkhtmltopdf.exe into one of my projects which ist called via process.start(). I wrapped the VB.NET-Code into a DLL, which is configurated to do COM-Interop. The COM-Library is called from VBA-Code in Access.
If process.start() is called the .NET-Runtime causes Exception "Access denied".
If I debug program or execute it in an "only .NET Environment" the Exception is not raised.
Why?
|
|
|
|
|
How can I write a code in a button (in Visual Basic) that Will save Work and returns (Massage Saved Successfully)
|
|
|
|
|
How about serialize your data structures to a file?
It's impossible to answer your question more specifically because we know nothing about your app at all.
|
|
|
|
|
Aaaaaaaaaaaaaaaaaarg! As usual once I post I figure it out.
The PropertyGrid does not maintain the state. It has to be reloaded. How Dumb.
Sorry
Hello all,
I have a problem where the PropertyGrid does not update a property when changing a property to ReadOnly and not ReadOnly. The problem occurs when I have 2 controls of the 'same type'.
Below is test code which contains all of the things I have tried to refresh the PropertyGrid with no success.
When Control1 is loaded into the PropertyGrid I change the DesignLocked state and update the ReadOnly state of the PostPrintString to Readonly or not ReadOnly depending on the DesignLocked Value. This works in Control1.
However, after I have changed the value in Control1 and then select Control2 into the PropertyGrid (through a button click in MainForm), the PostPrintString property in the grid maintains the same ReadOnly state of Control1.
I've tried a number of things I've seen on google including NotifyParentPropertyAttribute with no success.
I would appreciate any help with this.
Thank you
This is the test code in MainForm to load each control.
Private Sub Ctrl1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ctrl1.Click
Me.PropertyGrid1.SelectedObject = Nothing
Me.PropertyGrid1.Refresh()
Me.PropertyGrid1.SelectedObject = Me.ctrl1
Me.PropertyGrid1.Refresh()
End Sub
Private Sub Ctrl2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ctrl2.Click
Me.PropertyGrid1.SelectedObject = Nothing
Me.PropertyGrid1.Refresh()
Me.PropertyGrid1.SelectedObject = Me.ctrl2
Me.PropertyGrid1.Refresh()
End Sub
Below is the test code in a UserControl that shows what I do when I change the DesignLocked property.
Imports System.ComponentModel
Imports System.Reflection
Public Class TestUserControl
' Gets loaded with MainForms PropertyGrid
Public _PropertyGrid As PropertyGrid
<CategoryAttribute("AA"), _
EditorBrowsable(EditorBrowsableState.Always), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), _
Browsable(True), _
[ReadOnly](False), _
BindableAttribute(False), _
DefaultValueAttribute(""), _
DesignOnly(False), _
DescriptionAttribute("")> _
Public Property PostPrintString() As String
Get
Return ""
End Get
Set(ByVal value As String)
End Set
End Property
''' <summary>
''' Get/Set local DesignLocked state
''' </summary>
''' <remarks></remarks>
Protected _enumDesignLocked As GlobalLib.CommonData.enumEnableDisable = GlobalLib.CommonData.enumEnableDisable.Enabled
<CategoryAttribute("AA"), _
EditorBrowsable(EditorBrowsableState.Always), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), _
Browsable(True), _
[ReadOnly](False), _
BindableAttribute(False), _
DefaultValueAttribute(GetType(GlobalLib.CommonData.enumEnableDisable), "Disabled"), _
DesignOnly(False), _
DescriptionAttribute("")> _
Public Property DesignLocked() As GlobalLib.CommonData.enumEnableDisable
Get
Return Me._enumDesignLocked
End Get
Set(ByVal value As GlobalLib.CommonData.enumEnableDisable)
If value = GlobalLib.CommonData.enumEnableDisable.Enabled Then
' Sets ReadOnly
EnableProperty(Me, True, "PostPrintString")
'GlobalLib.Methods.EnableProperty(Me, True, "PostPrintString")
Else
' Clears ReadOnly
EnableProperty(Me, False, "PostPrintString")
'GlobalLib.Methods.EnableProperty(Me, False, "PostPrintString")
End If
Me._enumDesignLocked = value
Me._PropertyGrid.Refresh()
End Set
End Property
Public Sub EnableProperty(ByVal ctrl As Control, ByVal bState As Boolean, ByVal sPropName As String)
Dim descriptor As PropertyDescriptor = TypeDescriptor.GetProperties(ctrl.GetType())(sPropName)
If descriptor IsNot Nothing Then
Dim attr As ReadOnlyAttribute = descriptor.Attributes(GetType(ReadOnlyAttribute))
If attr IsNot Nothing Then
Dim field As FieldInfo = attr.GetType().GetField("isReadOnly", _
System.Reflection.BindingFlags.NonPublic Or _
System.Reflection.BindingFlags.Instance)
If field IsNot Nothing Then
field.SetValue(attr, bState)
'GlobalLib.DebugModule.DebugTextOut(String.Format("{0} - {1}", sPropName, attr.IsReadOnly()))
End If
End If
End If
End Sub
''' <summary>
''' Get/Set CustomTextBox.PostPrintString.
''' Defines text to be concatenated to the normal .Text when printing.
''' </summary>
''' <remarks></remarks>
<CategoryAttribute("AA"), _
EditorBrowsable(EditorBrowsableState.Always), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), _
Browsable(True), _
[ReadOnly](False), _
BindableAttribute(False), _
DefaultValueAttribute(""), _
DesignOnly(False), _
DescriptionAttribute("")> _
Public Property CtrlName() As String
Get
Return MyBase.Name
End Get
Set(ByVal value As String)
End Set
End Property
Private Sub TestUserControl_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
e.Graphics.FillRectangle(Brushes.AliceBlue, Me.ClientRectangle)
e.Graphics.DrawString(Me.Name, Me.Font, Brushes.Black, 3, 3)
End Sub
End Class
-- modified 31-Jan-21 12:25pm.
|
|
|
|
|
What's the leanest and meanest way to get zlib.dll inflation and deflation??
|
|
|
|
|
albert_redditt wrote: What's the leanest and meanest way to get zlib.dll inflation and deflation?? Add a reference to the file and then start using it.
|
|
|
|
|
Reading the documentation.
|
|
|
|
|
I am trying to making a webscraping code and i have searched a lot and could not find any relevevant code. which scrap the below details from the webside.
your help in this regard will be highly appreciated.
Item name
item price
Shipping price
Sub Web_Scraping()
Dim Internet_Explorer As InternetExplorer
Set Internet_Explorer = New InternetExplorer
Internet_Explorer.Visible = True
Internet_Explorer.navigate ("https://www.ebay.com/sch/i.html?_nkw=045496902612+-Disc+-Only+-Refurbished+-Used+-Lot+-Import+-Japan+-Repro+-Reproduction+-Replacement+-VGA+-Graded+-Edition+-Edtion+-EU+-Mod+-Mods+-Moded+-modded+-Digital+-Collection+-Bundle+-Code+-Codes&LH_TitleDesc=0&LH_BIN=1&LH_Sold=1&rt=nc&LH_PrefLoc=1&LH_ItemCondition=3")
Do While Internet_Explorer.readyState <> READYSTATE_COMPLETE: Loop
MsgBox Internet_Explorer.LocationName & vbNewLine & vbNewLine & Internet_Explorer.LocationURL
For Each item In respJSON("QuickQuoteResult")("QuickQuote")
ThisWorkbook.Worksheets(1).Cells(i, "A") = item("Item name")
ThisWorkbook.Worksheets(1).Cells(i, "B") = item("item price")
ThisWorkbook.Worksheets(1).Cells(i, "C") = item("Shipping price")
End Sub
|
|
|
|
|
Don't try to scrape the details from the website. Even if you get it to work, the code will be brittle and will break at the slightest change of markup on eBay's pages.
It will also potentially breach eBay's terms and conditions.
Use the API instead:
All API documentation[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Alright Thank you for the help.
|
|
|
|
|
|
Hello everyone, i've been assignt at my university to create on visual studio a personal appointment reminder visual basic. My profeccor asked me to find a code on the internet for the subject to create this project.. I searched all over the internet and i couldn't find a simple reminder code or tutorial that can help me.. Does anyone have any idea where to find such a code?
|
|
|
|
|
|
Your prof actually said: "Don't use your own work ... copy it from the internet"?
You should ask for your money back. And in VB yet.
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
|
|
|
|
|
Dear All
Please help me to write VBA code
DATA
Type PMT VCHNO VCHDT ACode Ref1(N) Ref2(InvNo) Ref3(Description) Amount
BANK TT 123123 01/01/2021 ABCD123 987654 TTNO 123123 120
BANK TT 123123 01/01/2021 ABCD123 987653 TTNO 123123 125
IOU CASH 123123 01/01/2021 ABCD124 MANO 654321 505
IOU CASH 123123 01/01/2021 XYZ123 MANO 45689 605
IOU CASH 123123 01/01/2021 FDE987 MANO 75375 550
PETTY CASH 123123 01/01/2021 6528 TEA EXPENSES 650
BANK CHEQUE 123121 01/01/2021 IOP643 987689 CH NO 64321 5555
-------------------------
RESULT
Vch Date Vch No Account Code Description Amount Dr/Cr
01/01/2021 BP123123 ABCD123 TTNO 123123 245 Dr
01/01/2021 BP123123 BANK TTNO 123123 -245 Cr
01/01/2021 IOU123123 ABCD124 654321 505 Dr
01/01/2021 IOU123123 XYZ123 45689 605 Dr
01/01/2021 IOU123123 FDE987 75375 550 Dr
01/01/2021 IOU123123 IOU SETTLE ON -1660 Cr
01/01/2021 CP123123 6528 TEA EXPENSES 650 Dr
01/01/2021 CP123123 CASH TEA EXPENSES -650 Cr
01/01/2021 BP123121 IOP643 CH NO 64321 5555 Dr
01/01/2021 BP123121 BANK CH NO 64321 -5555 Cr
|
|
|
|