0

I have 2 tables defined like this:

Number 1:

public class InputEmail
{
    [Key]
    public string EmailAddress { get; set; }

    public string Hostname { get; set; }

    public string Password { get; set; }

    public int PortNo { get; set; }

    public virtual OutputEmail OutputEmails { get; set; }
}

Number 2:

public class OutputEmail
{
    [Key]
    public string EmailAddress { get; set; } 
}

In my program I have a Combobox in which I load the emails from InputEmail and the goal is that depending on what email the user selects from the Combobox the entire row in my table for which the email is the key to be shown in a messagebox.

I was thinking of using the .Find thingy but I can't seem to figure out how to make it work. If someone can link me to a page like this or to a page where I can read up on this I would gladly appreciate it.

Community
  • 1
  • 1

1 Answers1

0

I used the Find function like this :

 string combo = comboBox1.SelectedValue.ToString();
 var rand = ctx.InputEmails.Find(combo);

Console.WriteLine(rand.EmailAddress);

And it returned the specific items which I was looking for.