473,508 Members | 2,133 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 ITypeDescriptorContext, ByVal t As Type) As Boolean
If (TypeOf t Is String) Then
Return True
End If
Return MyBase.CanConvertFrom(context, t)
End Function
C# That Im getting error on
-----------------------------------
public override bool CanConvertFrom(ITypeDescriptorContext context, Type t)
{
if(typeof(t) is String){
return true;
}
return base.CanConvertFrom (context, t);
}

--
Ron Vecchi
Nov 17 '05 #1
2 1076
"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:OI**************@tk2msftngp13.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 ITypeDescriptorContext, ByVal t As Type) As Boolean
If (TypeOf t Is String) Then
Return True
End If
Return MyBase.CanConvertFrom(context, t)
End Function
C# That Im getting error on
-----------------------------------
public override bool CanConvertFrom(ITypeDescriptorContext context, Type t) {
if(typeof(t) is String){
return true;
}
return base.CanConvertFrom (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.String" )
{
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
1989
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:...
2
1217
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
7367
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...
5
1635
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...
1
5104
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...
0
1332
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: ...
2
2644
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...
6
2459
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? ...
3
2536
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...
0
7124
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...
0
7326
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,...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4707
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...
0
3195
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...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.