|
I am using text boxes to enter names. If the text is entered in lower case letters i have put a line of code to change the first letter to upper case
txtName1.Text = Char.ToUpper(txtName1.Text.Chars(0)).ToString() + txtName1.Text.Substring(1)
like so. My problem is, suppose the name is double barreled like carly-anne
i can change the C to a capital but how do i change the second name "anne" to "Anne"
Thanks from Zeldacat
|
|
|
|
|
My guess would be to look at the previous letter and convert the current letter to Upper Case if it is a ' ' or a '-'.
Mike Lasseter
|
|
|
|
|
try:
Public Sub Replace(ByRef Text As String, ByVal Separator As String)
If Text.Contains(Separator) Then
Dim i As Integer
i = Text.IndexOf(Separator)
Text = Text.Insert(i + 1, Char.ToUpper(Text.Chars(i + 1)))
Text = Text.Remove(i + 2, 1)
End If
Text = Text.Insert(0, Char.ToUpper(Text.Chars(0)))
Text = Text.Remove(1, 1)
End Sub
AEK
|
|
|
|
|
'Or you can try this.
--------------with comments-----------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.TextBox1.Text <> Nothing Then 'make sure the textbox value is exist.
Dim NameParts As String() = Split(Me.TextBox1.Text) 'split the name parts into an array.
Dim FullName As String = "" 'make a buffer to save the processed name parts.
Dim nMax As Integer = NameParts.GetUpperBound(0) 'number of name parts.
For i As Integer = 0 To nMax 'iterate through the element of name part array.
'Replace first character with upper case character on each elements.
NameParts(i) = Mid(NameParts(i), 1, 1).ToUpper & Mid(NameParts(i), 2).ToLower
FullName &= NameParts(i) & " " 'save into buffer.
Next
Dim xTrim As Integer = FullName.Length - 1 'count characther length in fullname
FullName = Mid(FullName, 1, xTrim) 'remove space character at the end of fullname.
Me.TextBox1.Text = FullName 'put the processed value back into textbox
End If
End Sub
--------------without comments-----------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.TextBox1.Text <> Nothing Then
Dim NameParts As String() = Split(Me.TextBox1.Text)
Dim FullName As String = ""
Dim nMax As Integer = NameParts.GetUpperBound(0)
For i As Integer = 0 To nMax
NameParts(i) = Mid(NameParts(i), 1, 1).ToUpper & Mid(NameParts(i), 2).ToLower
FullName &= NameParts(i) & " "
Next
Dim xTrim As Integer = FullName.Length - 1
FullName = Mid(FullName, 1, xTrim)
Me.TextBox1.Text = FullName
End If
End Sub
|
|
|
|
|
I have a problem :
Description of problem:
When I use coding to copy a large file like 700MB to a different location. It takes upto 5 minutes. So I want to show some continues working Progress Bar.
But when it starts copy process all the activities hanged. No Progress bar visible at that time.
Please give any solution.
|
|
|
|
|
|
try
progressbarname.refresh
in loop that copies the file
|
|
|
|
|
Well, you've got a bit of a problem. Just putting a ProgressBar on a form doesn't do anything. You have to update it with, well, progress.
If you're using the File.Copy method, you'll never get that progress. It's a blocking call that doesn't report anything during the copy.
In order to make a progress bar work, you have to copy the file yourself using file stream methods. You know...open a file read some of it, write that to another file. Well, that's where you update the ProgressBar.
You get the size of the file first, start copying the file, track how much of the file you've copied and update the ProgressBar as you're copying the file.
Like the others have said, you can even move the copy operation to another thread so your UI stays responsive.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am using vb.net 2005 and I would like to be able to pragmatically bring up a new Gmail compose window logged in to a gmail account that I will supply the username and password to and then fill the form out pragmatically including:
To field, CC field, BCC field, Body field with HTML text, add multiple attachments.
Has anybody done this or know of a component or URL protocol out there that I can accomplish specifically this with?
Best Regards,
Brent Stringer
|
|
|
|
|
Have you tried looking at the Google API. Most of Google's services use a standard set of API that a developer can use in their programs. However, they do impose limitations on at least the searches available with the searching API, and the developer must register to use the API.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Dear All,
I hope your all professional people can help me this issue.
If I don't know all the table name inside a database. I want to retreive all the table name out. How to do it? (using VB.Net)
After this, I also want to retreive the fields name and their type, how to retreive it using a VB code?
Actually I want to write a import data which can let user select want to import which data table and name. I need the code to help me.
Thanks.
|
|
|
|
|
vincentkhoosiongleng wrote: I want to retreive all the table name out.
If you are using SQL Server 2000, you can query table sysobjects.All user tables have the type column = 'U'
vincentkhoosiongleng wrote: I also want to retreive the fields name
You can query syscolumns based on the ids of the tables you retrieved from queyring sysobjects
|
|
|
|
|
hi i want to build desktop application that should stay alligned on to position of the screen just as taskbar stays on bottom with the ability to autohide after some definate time and ability to cover desktop area as well ... i want if any can help me give any example how to build such a an application or find me on the web... any help will be much appreciated !!! Thanks a lot;)
Do Not Follow Where The Path May Lead.
Go Instead Where There Is No Path; and leave a Trail
|
|
|
|
|
Found a nice article here at CP written by Neil Yao that handles the docking and auto hiding. It's in C++ so you could convert it to vb or just us the dll. CAppBar[^]
|
|
|
|
|
Hey all,
I have the folling code to post data to a php page. However, I'd like to retreieve the response from this page after the posting and save it to a file. The response should just be plain-text XML. (IE, it'll echo out an XML file in plain text as the source). Is there a way to use something like the downloadstring(URL) on this AFTER posting up the data, in order to capture the response?
Thanks,
Mike
Public Function PostToWebUpdate(ByVal postData) As Boolean<br />
Dim Client As WebClient<br />
Try<br />
<br />
Dim dataBytes As Byte() = Encoding.ASCII.GetBytes(postData)<br />
<br />
Client = New WebClient<br />
Client.Headers.Add("Content-Type", "application/x-www-form-urlencoded")<br />
Dim returnedBytes As Byte() = Client.UploadData("http://www.mysite.com/folder/file.php", dataBytes)<br />
<br />
Dim myResponse As String = New String(Encoding.ASCII.GetChars(returnedBytes))<br />
<br />
Return myResponse = "SAVED"<br />
Catch ex As Exception<br />
MessageBox.Show("Error: PostToWeb: " & ex.Message)<br />
Return False<br />
Finally<br />
Client.Dispose()<br />
Client = Nothing<br />
End Try<br />
End Function
Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
|
|
|
|
|
|
alexrad wrote: WHAT WAS OR IS MY MISTAKE
YOU'RE YELLING! Quiet down...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
As you have been repeatedly told, but don't seem to get the idea yet. TYPING EVERYTHING IN CAPS MEANS THAT YOU'RE YELLING AT THE TOP OF YOUR LUNGS! DON'T...do it...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Why are u yelling, it can harm people?
|
|
|
|
|
Your probably didn't make one. It's one of those little quirks that doesn't have an explanation. Though, that may change with the release of SP1 for Visual Studio .NET 2005.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thangs Dave, i will no more yell,but those things
are too much for 2 in the morning
|
|
|
|
|
I would like to be able to know when a key is pressed within my application. I've been looking at different options and came across keyboard and mouse hooks. The examples I've seen (unfortunately for me written in c#) seem to only be for global hooks. I'm not interested in what happens outside of the program I'm writing, just when the program is active should it listen for a keypress. It would be nice if it didn't matter which control had the focus either. The idea is to create a commandline that becomes activated instantly when a certain key is pressed.
I'm not sure if hooks are the right direction to go for this or perhaps there is something simpler that I can use.
Any help would be greatly appreciated.
Thanks,
David
|
|
|
|
|
You don't need a global hook for this. All you have to do is set the Form's KeyPreview property to True, then handle the Form's KeyDown event. It'll give you all the keystrokes going to that form, even it's child controls, before the controls see the keystroke.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
Are there any good, methods of creating a routine in an application, making the application trialware, until a key code has been entered. Must stop application running after x uses or x days after original install date.
Thanks, Andrew Robinson.
|
|
|
|