|
-
Feb 11th, 2000, 01:00 AM
#1
Thread Starter
Hyperactive Member
Why does VB give me a Run-time Error 13 "Type Mismatch" when it executes this code?
txtcust_name.Text = txtcust_name.Text - txtcust_name.SelText
------------------
Ryan
-
Feb 11th, 2000, 01:07 AM
#2
-
Feb 11th, 2000, 01:11 AM
#3
Addicted Member
VB does not belive in Mathematics with strings..
If txtcust_name.text is full of numbers then
this should work....
txtcust_name.Text = val(txtcust_name.Text) - val(txtcust_name.SelText)
else if they have string and what you are trying to acheive is to rip of txtcust_name.SelText string from txtcust_name.Text ...
Then select the text using seltext and then change the seltext to ""
===============================
-
Feb 11th, 2000, 01:13 AM
#4
-
Feb 11th, 2000, 02:02 AM
#5
Thread Starter
Hyperactive Member
Ok, well thank you for your ideas, although I came up with my own. Here's what I did:
Dim x As Integer
x = Len(txtcust_name.Text) - Len(txtcust_name.SelText)
txtcust_name.Text = Mid(txtcust_name.Text, 1, x)
And that effectively truncates the selected text from the string. But thank you for you ideas. And I hope they change this in VB7. It would be so much easier to be able to do it how I wanted to. 
------------------
Ryan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|