473,772 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cannot implicitly convert 'string' to 'bool' / cannot implicitly convert 'bool' to 's

3 New Member
public bool[] searchGame(stri ng gameName)

{

string[] searchGame = {"Tibia", "Combat Arms", "Need for Speed", "Moto GP", "Risk", "Red Alert", "Monopoly", "Scrabble"} ;


if ( searchGame[0] == "Tibia")

{

return true;

}

else

{

return null;

}
//kindly please help me out. i'm doing a search button when a string is input. this is under web service.
Dec 1 '08 #1
4 6752
PRR
750 Recognized Expert Contributor
well your return type
public string[] searchGame(stri ng gameName)
should be bool as you are returning boolean type ..
public bool searchGame(stri ng gameName).
i got to say,.. this is pretty basic...Do go through a good C#.NET book..
Dec 1 '08 #2
cowdung7
3 New Member
yea i tried using bool but another error came out "cannot implicitly convert 'bool' to 'bool[]'. tried googling it but no result. i'm sorry for the basic error but i'm only a beginner
Dec 1 '08 #3
PRR
750 Recognized Expert Contributor
bool not bool[], you are returning true or false...
Dec 1 '08 #4
anijos
52 New Member
public bool searchGame(stri ng gameName)

{

string[] searchGame = {"Tibia", "Combat Arms", "Need for Speed", "Moto GP", "Risk", "Red Alert", "Monopoly", "Scrabble"} ;


if ( searchGame[0] == "Tibia")

{

return true;

}

else

{

return false;

}
Dec 1 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

22
27898
by: Christoph Boget | last post by:
I am getting an error (a few among many) for the following lines of code: retval.BrokerName = (( curRow == System.DBNull.Value ) ? SqlString.Null : (string)curRow ); retval.BrokerGroupId = (( curRow == System.DBNull.Value ) ? SqlInt32.Null : (int)curRow ); The errors are (in turn):
2
6153
by: Jeff | last post by:
I get the following error: Cannot implicitly convert type 'Factory.Stack.pArrayStack' to 'Factory.Stack.StackDefs.ImStack' at compile time. I thought perhaps there was a mismatch between the interface method types and the actual implementation types, so I removed all methods from both the interface and the implementation (pArrayStack ) but still get the error. Here is the code with just one simple method still declared and implemented.
2
6739
by: Patrick Olurotimi Ige | last post by:
When i convert:- this code from VB to C# Why do i get error "Cannot implicitly convert type 'object' to 'bool' VB --- If cmdcommand.Parameters("ReturnValue").Value = 1 Then lblStatus.Text = "Username already exists!" Else lblStatus.Text = "Success!"
9
10530
by: Andy Sutorius | last post by:
Hi, I am receiving the error when compiling the project, "cannot implicitly convert type object to string". The error points to this line of code and underlines the dtrRecipient: objMailMessage.To = dtrRecipient; I'm not sure why I am getting this error. Below is the complete code I am working with.
6
30717
by: eric.goforth | last post by:
What's wrong with this? if (bool)(UserIDs == ThisUserId) { return true; }
6
16999
by: Doug | last post by:
Hi I have a short piece of trial code that compares some input and then produces a message based on the value. However I get a build error that i dont know how to resolve ' Cannot implicitly convert type 'double' to 'bool' The code is
2
3662
by: Nick | last post by:
I am trying to find out if particular array element contains InputOutput value. private static int FillParameters(DbCommand command, SqlParameter p) { int x = 0; //int initalize to hold zero for (int i = 0; i < p.Length; i++) { command.Parameters.Add(p); if (p.Direction = ParameterDirection.InputOutput) <<<==
7
16710
by: groups | last post by:
This is my first foray into writing a generic method and maybe I've bitten off more than I can chew. My intent is to have a generic method that accepts a value name and that value will be returned from the source. My first attempt was as follows; (please ignore that error handling is not present in this example) public T GetValue<T(string objName) { T results;
4
9933
by: hellomac23 | last post by:
Hi im trying to write a if...else for C# but i keep getting Cannot implicitly convert type 'int' to 'bool' i really lost can anybody help me on what that means
0
9454
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6713
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2
3609
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.