bjwade62 Posted September 28, 2006 Posted September 28, 2006 Here's what I have. The selected text in a FileListBox is Detail.wmf. I'm trying to get strTrimmed to equal Detail without the .wmf. The trim never happens. No errors.... What am I doing wrong? Dim strTrimmed As String = Me.FileListBox.Text.TrimEnd(".wmf") thanks, Bernie Quote
Administrators PlausiblyDamp Posted September 28, 2006 Administrators Posted September 28, 2006 http://msdn2.microsoft.com/en-us/library/system.string.trimend.aspx would be worth a read as it explains what .TrimEnd does. If you want to remove the .wmf from the string you could either use something like Dim strTrimmed As String = Me.FileListBox.Text.Substring(0, s.Length - 4) or even better use the Path class to do the work for you. Dim strTrimmed As String = System.IO.Path.GetFileNameWithoutExtension(Me.FileListBox.Text) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
bjwade62 Posted September 29, 2006 Author Posted September 29, 2006 I really like example #2. Thanks. Works great! http://msdn2.microsoft.com/en-us/library/system.string.trimend.aspx would be worth a read as it explains what .TrimEnd does. If you want to remove the .wmf from the string you could either use something like Dim strTrimmed As String = Me.FileListBox.Text.Substring(0, s.Length - 4) or even better use the Path class to do the work for you. Dim strTrimmed As String = System.IO.Path.GetFileNameWithoutExtension(Me.FileListBox.Text) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.