hi guys i got problem on both of my userID.GetUserByID
and getIP.GetIPAddress
it tells me that i Cannot convert from 'method group' to 'string'
but if i don't add even one of them i don't get an error but i add either one of the that error pops up. down below is my code on form, dal and for my ip
sBarcodeValidation = new ValidateBarCode3Repository().ValidateBarCode3(
sBarCode,
userID.getUserByID,
getIP.GetIPAddress,
modGlobal.gBoothID = Settings.Default.BoothID);
here is my code for getUserByID
public class GetUserByID
{
CACHE CacheConnection = new CACHE();
public string getUserByID(GetAllUsers getUserByID)
{
try
{
CacheConnection.ClearParameters();
CacheConnection.AddParameter(getUserByID.ID);
return CacheConnection.ExecuteQuery("AGSP.Users", "GetUserByID", CommandType.StoredProcedure, InterSystems.Data.CacheTypes.ClientTypeId.tString);
}
catch (Exception ex)
{
throw ex;
}
}
}
and here's my code for getting my ipaddress
public class GetIp
{
//public void getHostName()
//{
// string hostName = Dns.GetHostName(); // Retrive the Name of HOST
// // Get the IP
// string myIP = Dns.GetHostEntry(hostName).AddressList[1].ToString();
//}
public static IPAddress GetIPAddress()
{
IPAddress ip = Dns.GetHostAddresses(Dns.GetHostName()).Where(address =>
address.AddressFamily == AddressFamily.InterNetwork).First();
return ip;
}
}
I could tell you had some vb.net experience. In vb.net the parenthesis following a method call are provided by the editor and sometimes just assumed like in .ToString. Ok in vb but not in C#.
getIP.GetIPAddress
needs to be
getIP.GetIPAddress()
and
userID.getUserByID
needs to be
userID.getUserByID()