Click here to Skip to main content
15,892,072 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRe: Unable to load xlsm file with Office 2016 Pin
Maciej Los24-Jan-19 2:49
mveMaciej Los24-Jan-19 2:49 
QuestionA Class Model with sort capabilities, Linq Sort, Array Sort instead of OrderBy Pin
jkirkerx17-Jan-19 8:45
professionaljkirkerx17-Jan-19 8:45 
AnswerRe: A Class Model with sort capabilities, Linq Sort, Array Sort instead of OrderBy Pin
Mycroft Holmes17-Jan-19 12:39
professionalMycroft Holmes17-Jan-19 12:39 
GeneralRe: A Class Model with sort capabilities, Linq Sort, Array Sort instead of OrderBy Pin
jkirkerx17-Jan-19 13:19
professionaljkirkerx17-Jan-19 13:19 
QuestionCode not taking pictures from webcam when form in system tray Pin
Frankie_M15-Jan-19 23:46
Frankie_M15-Jan-19 23:46 
AnswerRe: Code not taking pictures from webcam when form in system tray Pin
Eddy Vluggen20-Jan-19 1:57
professionalEddy Vluggen20-Jan-19 1:57 
GeneralRe: Code not taking pictures from webcam when form in system tray Pin
Frankie_M21-Jan-19 22:14
Frankie_M21-Jan-19 22:14 
QuestionLosing Link state with CHARFORMAT2 definition ;Closed Pin
mo149215-Jan-19 12:56
mo149215-Jan-19 12:56 
The below code sets the selected text in the RichTextBox to a protected link.
This works but I have an issue when entering text before the link; particularly
a space char. When I enter a space character before the link, the link loses
it's link state;

1. The color changes to normal text color.
2. The underline disappears.
3. I no longer receive the link click message.
4. It remains protected.

I can type other characters and do not lose the link state except when
the caret is on the space immediately preceding the link.

Test case with this text where link is the formatted link:
" abc link"

Hitting the spacebar anywhere between the 'c' and the 'l' causes the link to lose its state
Hitting any other char does not affect the state except when the char is next to the 'l' and
then it loses its state.

Anyone have an idea of why the link is losing it's attribute?
Thank you

Public Function SetSelectionCharFormat(ByVal hEdit As IntPtr, ByVal cf As CHARFORMAT2, _
Optional ByVal fmt As EMFormatMasks = EMFormatMasks.SCF_SELECTION Or EMFormatMasks.SCF_WORD) As Boolean
Dim bReturn As Boolean = False

' This is test code which overrides the input
cf.dwMask = (CFMMask.CFM_LINK Or CFMMask.CFM_PROTECTED) ' &h20 or &h10
cf.dwEffects = (CFEEffects.CFE_LINK Or CFEEffects.CFE_PROTECTED) ' &h20 or &h10

Try
Dim structPtr As IntPtr
' Allocate the memory for structure data
structPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cf))
' Copy structure data to memory ptr
Marshal.StructureToPtr(cf, structPtr, False)
' Return non-zero if passes; code from winctrl4.cpp

' fmt = the default (EMFormatMasks.SCF_SELECTION Or EMFormatMasks.SCF_WORD)
bReturn = (MyUtilsLib.WindowsAPI.SendMessage(hEdit, EMMessages.EM_SETCHARFORMAT, fmt, structPtr) <> 0)
' Free memory
Marshal.FreeHGlobal(structPtr)

#If DEBUG Then
If bReturn = False Then
Debug.WriteLine("SetSelectionCharFormat() failed")
End If
#End If
Catch ex As Exception
MsgBox(ex.Message())
End Try

Return bReturn

End Function

-- modified 23-Jan-19 15:38pm.
Questiontest compile mode versus production compile mode Pin
dcof7-Jan-19 5:10
dcof7-Jan-19 5:10 
AnswerRe: test compile mode versus production compile mode Pin
Richard MacCutchan7-Jan-19 5:33
mveRichard MacCutchan7-Jan-19 5:33 
GeneralRe: test compile mode versus production compile mode Pin
dcof7-Jan-19 9:42
dcof7-Jan-19 9:42 
GeneralRe: test compile mode versus production compile mode Pin
Richard MacCutchan7-Jan-19 9:50
mveRichard MacCutchan7-Jan-19 9:50 
GeneralRe: test compile mode versus production compile mode Pin
dcof8-Jan-19 6:17
dcof8-Jan-19 6:17 
Questioncall a Sub with a dynamic type parameter. Pin
desanti2-Jan-19 11:03
desanti2-Jan-19 11:03 
AnswerRe: call a Sub with a dynamic type parameter. Pin
Richard MacCutchan2-Jan-19 22:10
mveRichard MacCutchan2-Jan-19 22:10 
GeneralRe: call a Sub with a dynamic type parameter. Pin
desanti3-Jan-19 4:35
desanti3-Jan-19 4:35 
GeneralRe: call a Sub with a dynamic type parameter. Pin
Richard MacCutchan3-Jan-19 6:33
mveRichard MacCutchan3-Jan-19 6:33 
GeneralRe: call a Sub with a dynamic type parameter. Pin
Dave Kreskowiak3-Jan-19 6:36
mveDave Kreskowiak3-Jan-19 6:36 
AnswerRe: call a Sub with a dynamic type parameter. Pin
Eddy Vluggen2-Jan-19 22:14
professionalEddy Vluggen2-Jan-19 22:14 
GeneralRe: call a Sub with a dynamic type parameter. Pin
desanti3-Jan-19 4:35
desanti3-Jan-19 4:35 
GeneralRe: call a Sub with a dynamic type parameter. Pin
Ralf Meier17-Jan-19 0:34
mveRalf Meier17-Jan-19 0:34 
QuestionDirecotoryServices - Find all Windows 7 and Windows 10 Computers in Domain Pin
Member 1186689325-Dec-18 6:43
Member 1186689325-Dec-18 6:43 
AnswerRe: DirecotoryServices - Find all Windows 7 and Windows 10 Computers in Domain Pin
Eddy Vluggen2-Jan-19 23:02
professionalEddy Vluggen2-Jan-19 23:02 
QuestionThreading, Invoke, Delegate and MethodInvoker... Pin
Member 1111281423-Dec-18 3:03
Member 1111281423-Dec-18 3:03 
AnswerRe: Threading, Invoke, Delegate and MethodInvoker... Pin
Eddy Vluggen23-Dec-18 10:52
professionalEddy Vluggen23-Dec-18 10:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.