I'm trying to match selected year in ComboBox dropdown list with national holidays in Ireland, so when the user click on, e.g. 2010, he gets the list of holidays along with their corresponding dates in the TextBox1.
Looking at the proxy class available, I see there is a function called GetHolidaysForYear, which takes two parameters: year and CountryCode and returns the list of holidays in the form of an array. However, the array is empty. I don't understand why?
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.holidaywebservice.com/HolidayService_v2/GetHolidaysForYear", RequestNamespace="http://www.holidaywebservice.com/HolidayService_v2/", ResponseNamespace="http://www.holidaywebservice.com/HolidayService_v2/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public Holiday[] GetHolidaysForYear(Country countryCode, int year) {
object[] results = this.Invoke("GetHolidaysForYear", new object[] {
countryCode,
year});
return ((Holiday[])(results[0]));
}
Can I use the calling function in my handler for the "Find Holidays" button on my interface?
Here is the code for the GUI:
namespace GUI
{
public partial class Form1 : Form
{
int year;
HolidayService2 myHolidayClass = new HolidayService2();
public Form1()
{
InitializeComponent();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
//When pressed, the list of holidays should be displayed in the TextBox1
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
So the question is - how to pass the country code and a year? Surely the year is selected from the ComboBox, no? I managed to display the year in the textbox, when clicked in the dropdown menu, but that was just me babystepping into xml/c# coding. Any help will be appreciated!
I've reviewed the following threads already:
- code to populate a combobox with values from an xml file
- Getting XML data into combobox
- How do I read values from an XML document to build a ComboBox?
- How to read attribute value from XmlNode in C#?
- How to fill a ComboBox with values from a list, and bind the selected item to a string in another ViewModel
- XML Dropdown with Names and Values
- Trying to bind XML to a ComboBox using WinForm and C#
...but none seem to be answering my question. Thanks in advance!