I made a C # (WinForms) application to load the marks according to the type of vehicle that is selected (car, motorcycle or truck) in a combobox. I put the following code at a button:
private void btnCheck_Click_1(object sender, EventArgs e)
{
Object tipoVeic = cmbTipo.SelectedItem;
WebClient client = new WebClient();
var url = "http://fipeapi.appspot.com/api/1/" + tipoVeic.ToString() + "/veiculos/21.json";
var json = client.DownloadString(url);
var serializar = new JavaScriptSerializer();
var model = serializar.Deserialize<dynamic>(json);
lblTipo.Text = tipoVeic.ToString();
lblTipo.Visible = true;
cmbMarca.Items.AddRange(model);
}
When clicking will load the 'Brand' combobox. What happens is that when I click on load the combobox is populated with the information (Collection) repeatedly, as shown below.
Maybe I'm missing some information from the array, but I honestly do not know what to do in this case. If it was not very clear, let me know what I'm trying to say in the comments.
Thanks