{"id":3999,"date":"2009-12-27T09:16:28","date_gmt":"2009-12-27T08:16:28","guid":{"rendered":"http:\/\/hlrnet.com\/technoblog\/?p=3999"},"modified":"2015-07-30T12:18:22","modified_gmt":"2015-07-30T11:18:22","slug":"vb-rechttextbox-bestanden-openen-vet","status":"publish","type":"post","link":"https:\/\/hlrnet.com\/technoblog\/inicio\/vb-rechttextbox-bestanden-openen-vet\/","title":{"rendered":"VB RichTextBox: bestanden openen \/ vet"},"content":{"rendered":"<p>V. Ik heb problemen met de RichtextBox in Visual Basic 2008. Ik probeer bestanden te openen met RichTextBox1.LoadFile(bestandsnaam), m\u00c3\u00b9aar er gebeurt niets. En ik probeer tekst in vet te zetten met\u00c2\u00a0<span style=\"font-size: x-small;\">RichTextBox1.SelectionFont.Bold =Not RichTextBox1.SelectionFont.Bold, maar krijg de melding dat Bold ReadOnly is.<\/span><\/p>\n<p><span style=\"font-size: x-small;\">A. Als je een bestand wil openen, moet je eerst weten welk soort bestand dat is. Check de extensie met een functie:<\/span><\/p>\n<blockquote><p>If extensie(OpenFileDialog1.FileName) = &#8220;txt&#8221; Then RichTextBox1.LoadFile(OpenFileDialog1.FileName, RichTextBoxStreamType.PlainText)<br \/>\nIf extensie(OpenFileDialog1.FileName) = &#8220;rtf&#8221; Then RichTextBox1.LoadFile(OpenFileDialog1.FileName, RichTextBoxStreamType.RichText)<\/p>\n<p>Public Function extensie(ByVal pad As String) As String<br \/>\nReturn LCase(Mid(pad, Len(pad) &#8211; 2, 3))<br \/>\nEnd Function<\/p><\/blockquote>\n<p><span style=\"font-size: x-small;\">Om vet om te keren, moet je een object Font maken:<\/span><\/p>\n<blockquote><p>If richTextBox1.SelectionFont IsNot Nothing Then<br \/>\nDim currentFont As System.Drawing.Font = richTextBox1.SelectionFont<br \/>\nDim newFontStyle As System.Drawing.FontStyle<\/p>\n<p>If richTextBox1.SelectionFont.Bold = True Then<br \/>\nnewFontStyle = FontStyle.Regular<br \/>\nElse<br \/>\nnewFontStyle = FontStyle.Bold<br \/>\nEnd If<\/p>\n<p>richTextBox1.SelectionFont = New Font( _<br \/>\ncurrentFont.FontFamily, _<br \/>\ncurrentFont.Size, _<br \/>\nnewFontStyle _<br \/>\n)<br \/>\nEnd If<\/p><\/blockquote>\n<p><span style=\"font-size: x-small;\">\u00c2\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>V. Ik heb problemen met de RichtextBox in Visual Basic 2008. Ik probeer bestanden te openen met RichTextBox1.LoadFile(bestandsnaam), m\u00c3\u00b9aar er gebeurt niets. En ik probeer tekst in vet te zetten met\u00c2\u00a0RichTextBox1.SelectionFont.Bold =Not RichTextBox1.SelectionFont.Bold, maar krijg de melding dat Bold ReadOnly is. A. Als je een bestand wil openen, moet je<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1,"footnotes":""},"categories":[18,79],"tags":[122],"class_list":["post-3999","post","type-post","status-publish","format-standard","hentry","category-development","category-odisee","tag-vb"],"publishpress_future_action":{"enabled":false,"date":"2026-05-02 16:21:33","action":"delete","newStatus":"draft","terms":[],"taxonomy":"category","extraData":[]},"publishpress_future_workflow_manual_trigger":{"enabledWorkflows":[]},"_links":{"self":[{"href":"https:\/\/hlrnet.com\/technoblog\/inicio\/wp-json\/wp\/v2\/posts\/3999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hlrnet.com\/technoblog\/inicio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hlrnet.com\/technoblog\/inicio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hlrnet.com\/technoblog\/inicio\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hlrnet.com\/technoblog\/inicio\/wp-json\/wp\/v2\/comments?post=3999"}],"version-history":[{"count":0,"href":"https:\/\/hlrnet.com\/technoblog\/inicio\/wp-json\/wp\/v2\/posts\/3999\/revisions"}],"wp:attachment":[{"href":"https:\/\/hlrnet.com\/technoblog\/inicio\/wp-json\/wp\/v2\/media?parent=3999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hlrnet.com\/technoblog\/inicio\/wp-json\/wp\/v2\/categories?post=3999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hlrnet.com\/technoblog\/inicio\/wp-json\/wp\/v2\/tags?post=3999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}