473,569 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cant seem to transalte this VB code to C#

The error Im getting--
The type or namespace name 't' could not be found (are you missing a using
directive or an assembly reference?)
The error is referencing the IF expression

VB.NET to convert
-----------------------------------------------
Public Overloads Overrides Function CanConvertFrom _
(ByVal context As ITypeDescriptor Context, ByVal t As Type) As Boolean
If (TypeOf t Is String) Then
Return True
End If
Return MyBase.CanConve rtFrom(context, t)
End Function
C# That Im getting error on
-----------------------------------
public override bool CanConvertFrom( ITypeDescriptor Context context, Type t)
{
if(typeof(t) is String){
return true;
}
return base.CanConvert From (context, t);
}

--
Ron Vecchi
Nov 17 '05 #1
2 1079
"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:OI******** ******@tk2msftn gp13.phx.gbl...
The error Im getting--
The type or namespace name 't' could not be found (are you missing a using
directive or an assembly reference?)
The error is referencing the IF expression

VB.NET to convert
-----------------------------------------------
Public Overloads Overrides Function CanConvertFrom _
(ByVal context As ITypeDescriptor Context, ByVal t As Type) As Boolean
If (TypeOf t Is String) Then
Return True
End If
Return MyBase.CanConve rtFrom(context, t)
End Function
C# That Im getting error on
-----------------------------------
public override bool CanConvertFrom( ITypeDescriptor Context context, Type t) {
if(typeof(t) is String){
return true;
}
return base.CanConvert From (context, t);
}


Try "if (t is string)".
--
John
Nov 17 '05 #2
Hi Ron,

Firstly I want to thank John for his great help in this issue.

Based on my research and experience, what you want should be something like
the following code snippet.
...
String test = "Hello";
Type t = test.GetType();
if ( t.ToString() == "System.Str ing" )
{
TextBox1.Text = "Hello String";
}
...
Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1991
by: Jack Schafer | last post by:
I am trying to download the source code for an array of differant websites, usually i will get something like this from Dilbert.com: HTTP/1.1 200 OK Date: Fri, 23 Apr 2004 00:04:54 GMT Server: Apache/1.3.27 (Unix) Resin/2.1.s030505 mod_ssl/2.8.14 OpenSSL/0.9.7b Last-Modified: Thu, 22 Apr 2004 07:05:10 GMT ETag: "182ba6-9d7b-40876ea6"...
2
1219
by: gregory_may | last post by:
I am trying to switch to C# from VB. A few things I cant seem to find: * How to get those handy Try/Catch templates to appear when I type "Try" * How can I auto reformat my code?
2
7368
by: g35rider | last post by:
Hi, I have the following code that is giving this error, I cant simplify the code, I was just testing some theory for something we are doing and was getting an issue here. Please someone point out whats wrong with my code. class MsgData { char* data;
5
1640
by: Ouwet5775 | last post by:
Hello peeps. Well i have tried runing the folwoing program several times, and i cant figure out what i am doing wrong. The goal of this is to input values for an array, find the maximum and the do a linear search for a given number. But i cant seem to input the number anywhere. Any kind of input would help me out alot. Thanks ;)
1
5118
by: mike11d11 | last post by:
I'm doing a simple TableAdapter.Fill filling my datatable from a view within a SQL database. for some reason it is timing out after 30 seconds and I cant seem to find out where in vb.net 2005 I can go to change the timeout setting for this. when i go to my project, then my settings tab i set the connection timeout for 120, but it doesn't...
0
1337
by: rhyes | last post by:
Hi All, I cant seem to submit post and view the post in the example provided by thescripts there is no error and I manage to connect to the database. the link is below: http://www.thescripts.com/serversidescripting/php/tutorials/discussionforumswithphp/index.html I have make changes in the sql database name , username , password and the...
2
2658
by: moondaddy | last post by:
I had to repost this because I had to update and change my msdn alias. I will re-ask the question and clarify a few things that were not clear before. This code is all executed on my dev machine running winXP sp2 and VS2005. I'm using a c# 2.0 winforms app which talks to a c#2.0 asp.net app that also contains 1 web service. Note: the...
6
2466
by: WolfgangS | last post by:
Ok first off, i am a total beginner at this groups stuff and i have no clue how this works. This is probabaly the wrong group for my problem but i will post it anyways. Learning by doing right? I will post a code snippet and explain my problem. I cant seem to find a logical explanation why this problem would occur after trying to figure it...
3
2546
by: ukfusion | last post by:
Im trying to get an image upload script to work within a session file.....i can get it to work on a single page without any other script....but i need to have the image upload facility built into a add product form....so the script is currently sitting in a session file at the same point as where the fields are all validatedd....i've tried using...
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.