Click here to Skip to main content
15,896,915 members

Comments by Andre Oosthuizen (Top 200 by date)

Andre Oosthuizen 4 days ago View    
You can try this link to get started - Convert JSON to dictionary[^]
Andre Oosthuizen 4 days ago View    
Please show us your code you are using to understand where your code errors. As it stands now it is a question in the dark.
Andre Oosthuizen 26-Apr-24 13:36pm View    
I am not sure what your comment means...
Andre Oosthuizen 26-Apr-24 10:44am View    
Show us what output you are expecting and what output you are getting, we have absolutely no idea what your query looks like, what it does where and why.
Andre Oosthuizen 17-Apr-24 12:59pm View    
Using the values from the pointers is not entirely possible and WAY over even my head. Without testing, you can try the following but I personally think that is just paving the way for even more questions and less answers -
To calculate the width of the selection border indirectly you can use the information given by 'EM_GETMARGINS' and some additional Windows messages and properties -
Left and right margins using 'EM_GETMARGINS' -
Dim margins As New RECT()
Dim lParam As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(margins))
SendMessage(Me.Handle, EM_GETMARGINS, IntPtr.Zero, lParam)
margins = Marshal.PtrToStructure(lParam, GetType(RECT))
Marshal.FreeHGlobal(lParam)
Dim leftMargin As Integer = margins.Left
Dim rightMargin As Integer = margins.Right


Width of the rich text box control's client area by subtracting the left and right margins from the control's width -
Dim clientAreaWidth As Integer = Me.RichTextBox1.Width - leftMargin - rightMargin


Width of the rich text box control itself (including borders) by sending the 'EM_GETRECT' message -
Dim controlRect As New RECT()
Dim rectParam As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(controlRect))
SendMessage(Me.Handle, EM_GETRECT, 0, rectParam)
controlRect = Marshal.PtrToStructure(rectParam, GetType(RECT))
Marshal.FreeHGlobal(rectParam)
Dim controlWidth As Integer = controlRect.Right - controlRect.Left


Lastly, calculate the width of the selection border by subtracting the client area width from the control's width -
Dim selectionBorderWidth As Integer = controlWidth - clientAreaWidth