Nobody
Nobody
CC#
Created by Nobody on 4/4/2023 in #help
❔ Anyone know of a free, and acceptable way to display pdfs and docx files in winforms?
Thanks for the answers! I might be able to purchase devExpress Xtrareport, Unfortunately a trial wont do
7 replies
CC#
Created by Nobody on 3/29/2023 in #help
❔ Show values from a list in a datagridview getting source from bindingsource
List<MaterialModel> materials = new List<MaterialModel>();

using (var conn = new NpgsqlConnection(connectionString))
using (var cmd = conn.CreateCommand())
{
conn.Open();
cmd.CommandText = "SELECT * FROM AllInformationConsumables";
cmd.Connection = conn;
using (var reader = cmd.ExecuteReader())
{
while(reader.Read())
{
MaterialModel material = new MaterialModel();
material.Consumables = new List<ConsumableModel>(); //Vi hämtar data härifrån fast det är null, need to fix.
material.Name = reader.GetString(0);
for(int i = 1; i <= reader.FieldCount-1; i++)
{
ConsumableModel con = new ConsumableModel();
con.Name = reader.GetName(i); //DENNA FUCKAR ALLT, var off by one error :D
string[] valueUnit = reader.GetString(i).Split(" ");
con.Value = Convert.ToDouble(valueUnit[0]);
con.Unit = valueUnit[1];
//MessageBox.Show(con.ToString());
material.AddConsumable(con);

}
materials.Add(material);
}
}

}
return materials;
}
List<MaterialModel> materials = new List<MaterialModel>();

using (var conn = new NpgsqlConnection(connectionString))
using (var cmd = conn.CreateCommand())
{
conn.Open();
cmd.CommandText = "SELECT * FROM AllInformationConsumables";
cmd.Connection = conn;
using (var reader = cmd.ExecuteReader())
{
while(reader.Read())
{
MaterialModel material = new MaterialModel();
material.Consumables = new List<ConsumableModel>(); //Vi hämtar data härifrån fast det är null, need to fix.
material.Name = reader.GetString(0);
for(int i = 1; i <= reader.FieldCount-1; i++)
{
ConsumableModel con = new ConsumableModel();
con.Name = reader.GetName(i); //DENNA FUCKAR ALLT, var off by one error :D
string[] valueUnit = reader.GetString(i).Split(" ");
con.Value = Convert.ToDouble(valueUnit[0]);
con.Unit = valueUnit[1];
//MessageBox.Show(con.ToString());
material.AddConsumable(con);

}
materials.Add(material);
}
}

}
return materials;
}
13 replies
CC#
Created by Nobody on 3/29/2023 in #help
❔ Show values from a list in a datagridview getting source from bindingsource
Here is the method that loads all the materials into the list which is later used in the bindingsource
13 replies
CC#
Created by Nobody on 3/29/2023 in #help
❔ Show values from a list in a datagridview getting source from bindingsource
For each of these materials (test1, test2, test4) I would like its consumables to appear next to them, but also maintain that it material models since I have implemented the method to remove materials by clicking them and hitting a button. It is connected to a pgsql database which stores the materials and retrieves them
13 replies
CC#
Created by Nobody on 3/29/2023 in #help
❔ Show values from a list in a datagridview getting source from bindingsource
13 replies
CC#
Created by Nobody on 3/29/2023 in #help
❔ Show values from a list in a datagridview getting source from bindingsource
My datagridview takes a list of material models which it puts into its bindingsource. I get the following output to it:
13 replies
CC#
Created by Nobody on 3/29/2023 in #help
❔ Show values from a list in a datagridview getting source from bindingsource
13 replies
CC#
Created by Nobody on 3/29/2023 in #help
❔ Show values from a list in a datagridview getting source from bindingsource
The consumables is a list of consumablemodels, which needs a value, name and unit. Its to string method gives back its value and unit.
13 replies
CC#
Created by Nobody on 3/29/2023 in #help
❔ Show values from a list in a datagridview getting source from bindingsource
13 replies
CC#
Created by Nobody on 3/29/2023 in #help
❔ Show values from a list in a datagridview getting source from bindingsource
Well I think i was rather unclear with what I wrote. I will include some screenshots what will hopefully explain it better. I have this class MaterialModel with represents different materials.
13 replies