Unexpected Result Of RTF Line Ending Conversion
Jul 8, 2011
If txtLog is a RichTextBox control:
Dim text = "hi" & vbCrLf
Debug.WriteLine("t:" & text.Length) ' --> 4, as expected
txtLog.Text = text
Debug.WriteLine("tL:" & txtLog.TextLength) ' --> 3. muh?! :(
Having looked at the RTF spec, the end of a paragraph is notated as par, which is neither CR nor LF. This makes sense since RTF is markup language; like in HTML, line endings have little meaning on their own.
So presumably, on writing into the RichTextBox, my line ending is being encoded into par. And then, on extraction, the par is being translated back to a real line ending for use.
It turns out that this line ending is vbLf.
Why, since Microsoft near-consistently employ CRLF for line endings, would RichTextBox translate par to vbLf instead of vbCrLf?
View 2 Replies
ADVERTISEMENT
Jan 8, 2012
I have a small project which I want to add a different text at the beginning and the ending of each line in a multiline text box.I've tried this, But It only let me to add it at the beginning ( because I don't know the length of each line And also I have to write a code for each line which is very hard because the text box may contains 200 lines Dim lines() As String = TextBox1.Lines lines(0) = lines(0).Insert(0, "Hello World")TextBox1.Lines = lines I want for all lines without having to repeat it again for each line
View 7 Replies
Jan 20, 2010
I wrote a program that writes to a new created file a line of text. Anytime I try to open the new created file, I see a dialog box titled "Inconsistent Line Ending". I do understand why I receive this message. I wrote this program in VB.NET.
View 1 Replies
Apr 8, 2009
a user will enter a number, n, which ranges from 1 to 30. they will also enter a "P" or an "S" (sum or product). depending on which was selected, it will calculate the sum or product of the numbers from 1 to n.i'm having a conversion error on line 5 stating "Conversion from string "S" to type 'Double' is not valid." [code]
View 2 Replies
Mar 23, 2010
I am currently writing a code that prompts a user if they want to convert F to C or C to F, two functions with the calculations. My problem is my loop, it exits one time through and doesn't prompt again. And also doesn't display the final result.
' VB Script Document
option explicit
const menuBar = "Temperature Conversion"
Dim userPrompt, prompt, Temperature, toCelcius, toFahrenheit
prompt = vbOk
Do While prompt <> ""
[Code] .....
View 2 Replies
Oct 21, 2009
How would you convert this line of VB6 code to VB.NET 2005
HTML
sblock = StrConv(System.Text.UnicodeEncoding.Unicode.GetString(byteArr), vbUnicode)
View 3 Replies
Oct 22, 2009
I want to use explicit conversion (CType function in VB.NET) to convert the variable d from double type to integer type and store the result as 132.
Imports System.Console
Module Module1
Sub Main()
[CODE]...
This is my code. But Visual Basic tells me an error: Error1Type 'i' is not defined.C:\Users\mihaispr\Desktop\Conversie explicita\Conversie explicita\Module1.vb1922Conversie explicita
View 4 Replies
Jan 11, 2009
I have an array which contains strings.What i wan't to do is display the array as string, but after every fourth item the string must make a new line.I have the following code:
For n As Integer = 0 To ArrTekeningen.Count - 1
tekst2 = String.Join("-", ArrTekeningen)
If n = 3 Then 'start a new line after 4th item
[code]....
But with this code no new line is made.
View 4 Replies
Jul 28, 2010
i have form1 with combobox1 and rtb1 i would like to search the rtb1 for combobox1 selected value and return the first 9 characters from the line with the result.
COMBOBOX1
ADRIATIC
AMERICA
APAC-ANZ
[code]....
so if combobox1 selected.value = "BALTIC" then i would like "1209-4756" to become a named string (eg, cda = 1209-4756)
View 1 Replies
Aug 3, 2011
I have tried numuerous code conversion tools, and all have failed...I found an interesting snipper of code in C# that I have converted to VB, all but the following line of code. Cound someone please help to convert this C# to VB?
C#:
double totalRows = (int)myCommand.Parameters["@totalRows"].Value;
View 3 Replies
Jan 28, 2011
I have this snippet, it's in Java:
final InetAddress address = InetAddress.getLocalHost();
final NetworkInterface ni = NetworkInterface.getByInetAddress(address);
key = new String(ni.getHardwareAddress());
Example of key output: ▲╔UiÎ
What is the equivalent in VB.Net? I understand the first line gets Local Host, what about the rest?
View 1 Replies
Dec 10, 2010
I am currently having a headache on how to solve this problem that i am facing. here is the situation: I have a combobox and a list box on the main form. The combobox will get the data from the ms access database. In the database, i have the details of a person's IC, Name and DOB say for eg on one entry I have D215311523C,SHAWN,13/04/1987 So now, my combobox on form load will show the list of dates in the database to allow the user to search base on the date itself by clicking on the selected date. So when the user clicks on the particular date say 13/04/1987, people in the database whose birthday is 13/04/1987 will be shown on the listbox.Meaning to say if i have 3 entries whose dates are the same 13/04/1987, 3 entries will appear. If there is only two entry, then two results will be shown. But now, when i do a single click on the date, one result will be shown. That is correct. But the problem is when i click on the same date again, three of the same results will be shown on the list box. that is it will display : 13/04/1987 13/04/1987 13/04/1987 which is not the case. Then it will show more duplicates of the same results if i click more times on the same date which should not be the case.
Dim n As Integer
Dim numbers() As Integer
Dim StartFrom As Integer
Dim EndAt As Integer
[code].....
View 3 Replies
Sep 25, 2010
I am using a datagrid in my where i am having four columns. In first column the parameter values are entered and in the second column measured value is entered and in third column the nominal value is entered.Inthe fourth column the result is displayed by subtracting the measured value and nominal values. I am doing this calculation in Datagrid cell validated event. What i want is,there will be many rows in the grid,when typing the value in the third column the corresponding result will be displayedin the rowof theresult column,save button will be displayed while the form loads,when the calculate part is completed that is there should not any cell of the resut column empty then i should enable the save butto.
View 2 Replies
Oct 14, 2009
I am encountering the following issue So i have a device that sends stuff at the serial port, i then parse it and put it into an array of bytes like that:
Dim HCI_Command_Rcvd_Byte() As Byte All good till here What i wanna do is make an array and put this result every time the serial port gives me a new result, for example:
[Code]...
Basically what i wanna do is let the port parse the messages, fill in the array with the result at an empty spot in this array and then i will have a separate thread that will look in into this array in each non empty space and after it looks into the non empty space it will use or discard the info and also mark this space as empty (after it checked)
View 7 Replies
Oct 7, 2010
I am using Visual Basic 2010 and I am makeing a simple login app it prompts you for a username and password if it gets it right I want to open a form then close the previus one but when I do me.close it ends the program and I can't go on I am positive its working because I get the right password and username ut I can't close the first windows I tried to hide it but when I do I cant close it and the program goes on without quiting and with a hidden form I heard rumers that there is Sub that can control the x in the corner if there is one that would probably solve my problem but I can't find it heres the code for the login form
[code]...
View 3 Replies
Apr 16, 2010
I just read about DataSet in VB.NET, it uses disconnected concept. My question is: if my apps has "List All" button that query data from 1 table in the database, and that table has "very very very" many rows, so my DataSet will be filled with those data and eat up memory. Can I limit the data that being put to the DataSet from that query? But I want to be able to retrieve the next data from the same query if the user want to see it?
For example:
I have 1000 rows in my database, and i query all of them. But I just want 200 rows being inserted to my DataSet, but if the user want to see rows number 201 and so on, I want to be able to retrieve the next 200 rows, and so on. So it just like cutting those data into a group of 200 rows. Can I do this with the concept of "disconnected" of the DataSet?
View 5 Replies
Oct 9, 2010
I am writing a program in which I am testing a user's text box input. If it does not meet the required criteria, how do i end the sub program without closing the entire application?
View 3 Replies
Feb 29, 2012
I have the following code to insert some data from a GridView to a oracle database.
Protected Sub btnInsert_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInsert.Click
Dim con = New OleDbConnection("Data Source=sml2; User ID=sfpl; Password=a;
[code]....
View 1 Replies
Oct 30, 2009
How do I End a program without a button?I just want to use the Windows X button rather than having a button on the form.
View 2 Replies
Jun 3, 2011
When I create an instance of an Excel Application class and then quit the app and release the object (like below) the EXCEL process is still running in the the task manager. I have built an algorithm to find the process id and kill the process through that but I shouldn't have to.
xlApp = New Excel.ApplicationClass
'do stuff with excel app class instance
xlApp.Quit()
[Code]....
View 2 Replies
Feb 23, 2010
I'm writing a class library and I need to be able to shut down the main code in certain cases.
I know I could raise an event and listen for it in the form called by application.run but I would like to find a way around it.I wouldn't be opposed to try to throw an exception that if unhandled would close the application... but would prefer to come up with a more elegant soln.
View 1 Replies
Nov 4, 2010
I converted this app from VB6. I have 2 forms. Form1 instantiates Form2 via a Menu Item.I am having trouble getting Form2 to end when clicking close (X). If Form2 is 'idle' it closes fine; but if I am in a loop processing anything all the events fire, but it continues processing in Form2. I've tried messing with Dispose, Close, Application.Exit, Application.ExitThread. My last attempt was creating my own event to fire back to Form1 and dispose Form2 -- and it hits it but Form2 is still running. What is the deal? BTW if I use just Show vs ShowDialog -- Form2 just blinks and disappears.[code]
View 2 Replies
Jan 21, 2009
I converted this app from VB6. I have 2 forms. Form1 instantiates Form2 via a Menu Item.I am having trouble getting Form2 to end when clicking close (X). If Form2 is 'idle' it closes fine; but if I am in a loop processing anything all the events fire, but it continues processing in Form2. I've tried messing with Dispose, Close, Application.Exit,pplication.ExitThread. My last attempt was creating my own event to fire back to Form1 and dispose Form2 -- and it hits it but Form2 is still running. What is the deal? BTW if I use just Show vs ShowDialog -- Form2 just blinks and disappears.
Form1 does this
Dim f2 as Import
:
[code].....
View 6 Replies
Aug 3, 2010
Why is my beginning for each statement linking to the wrong ending next statement take a look at the code. The for each shipment is linking to the end next comp statement. My head is cracking open over this.
Dim getshipments = From s In mydb.ships _
Where s.ship_dte.Date <= month And s.ship_dte.Date >= month2 _
Group s By s.shipid, s.ord_num Into g = Group _
[Code].....
View 6 Replies
Mar 23, 2010
My look-behind: (?="","") is not working. This is due to the fact that I use .+ before it because I am parsing messages in a chat room where the users can literally type anything. The return is as follows for an example:
[Code]...
This depicts the beginning which contains the chat topic plus two messages. how exactly I would go about parsing the message out?
View 2 Replies
Jul 29, 2010
In the same line of this thread Now i have a problem with the control of the ending threads. This is my
vb.net threadsEnded = 0 For j As Integer = 0 To numThreads - 1
[Code]...
Some times the application doesn't finish and if i pause the application i see that the threadEnded var doesn't have the correct value, seems like some thread doesn't update the value of the var.
View 5 Replies
Jan 14, 2009
I am using a sub procedure that calls other subs. I was wondering if there was a way of ending the main sub from one of the called subs.I have been using Exit Sub but this only exits the sub which is currently in.
View 3 Replies
May 11, 2012
I'm creating a program in VB.net that does the following:At a high level I receive a file in email, put the attachment in a monitored folder, import the text file to excel, format the excel, and then email the excel file to a list of recipients.
Here is my plan:
Completed: Outlook VBA to monitor all incoming email for specific message. Once message is received drop attached .txt file in a specific network folder.
Completed: (VB.net) Monitor folder, when text file is added begin processing
Not Complete: (VB.net) Import text file to Excel
Not Complete: (VB.net) Format Excel Text file.(add in a row of data,format column headers with color/size, add some blank columns, add data validation to some of the blank columns that allow drop down selections)
Completed: (VB.net) Save file.
Completed: (VB.net) Send file to list of recipients.
Obviously the items above that are not complete are the bulk of the work, but I wanted to get some advice on what some of you think would be the best way to approach something like this. The import and formatting of the file are causing me some problems because I just can't decide what would be the most efficient way to do this.
The way stated above. Import to excel -> format Having a template excel that contains all of the formatting already done for me and attempting to transition the data to this document (no clue if/how I can do this). Is it even feasible? Have the template already created and then import the text file to a new excel file, then transition that data to the excel template?
Something I thought about, in terms of formatting the document, was to record a macro of me doing all of the formatting that I'm going to need and then attempt to convert that macro into my vb.net code, but I'm not sure if that will work. I will need to verify that the text file comes in the EXACT format every time correct?
View 5 Replies
Nov 20, 2009
Im trying to do a playbook application in vb.net. My problems is I dont know how to animate the pictureboxes. Im supposed to let them move once I play the animate button. Lets say i have a picture box with coordinate 20,30 and i would like it to move on run time to 450,300. how do I do it?
View 10 Replies
Jun 21, 2010
I would like to ask some help in my project. Im trying to do a playbook application in vb.net. My problems is I dont know how to animate the pictureboxes. Im supposed to let them move once I play the animate button. Lets say i have a picture box with coordinate 20,30 and i would like it to move on run time to 450,300.
View 1 Replies