How to create a Mesagebox by listing data in c#?

Asked

Viewed 49 times

1

I intend to create a notification, using messagebox, to list all products registered in the system with minimum amount once I run the system.

  • Messagebox is used for information messages, warnings and errors because it usually hangs the user until they close the window with the message. Also you have no formatting features in this window to put complex data. Best approach would be to create a specific form to present this data and Messagebox just to put something like "XYZ Report available. Want to open now?"

  • Reading the question better, I don’t think you’re forcing it to be Messagebox. A question, you’re using Forms or WPF?

1 answer

1


this is the class:

 class Lista_de_produto
 {
    public string Nome_produto { get; set; } 
    public int qtd  { get; set; } 

   public List<Lista_de_produto> GetAll()
   {
       List<Lista_de_produto> g=new List<Lista_de_produto>();

      //faça aqui o teu select, sem utilizar o where

       return g;
   }

 }

Here is in form

string Mensagem="";
int qtd_min=5; 
Lista_de_produto tg=new Lista_de_produto();
List<Lista_de_produto> List=tg.GetAll() ;  
List<Lista_de_produto> ver=List.FindAll(X => X.qtd <= qtd_min);

if(ver.Count>0)
{
    for(int a=0;a<=ver.Count;a++)
    {
      Mensagem=Mensagem+ver[a].Nome_produto +"\n";
    }
    MessageBox.Show(Mensagem);
 }
  • I’ve done something like that and it didn’t work

Browser other questions tagged

You are not signed in. Login or sign up in order to post.