Roofel
Roofel

Reputation: 1

Combobox selected value onto excel

I'm working on a class project that requires me to ask for user input and it requires it to export it onto an excel worksheet. I've been searching for a way to user the ComboBox.SelectedItem property into it but I couldn't figure it out. The following keeps giving me a NULL error and I can't figure out why. The ComboBox is created in Visual Studio.

        objSheet.Cells(Y, 1).Value = txtTel.Text
        objSheet.Cells(Y, 2).Value = txtEmail.Text
        objSheet.Cells(Y, 3).Value = txtSurname.Text
        objSheet.Cells(Y, 4).Value = txtName.Text
        objSheet.Cells(Y, 5).Value = ComboBox1.SelectedItem

Upvotes: 0

Views: 310

Answers (1)

BGD
BGD

Reputation: 219

ComboBox1.SelectedItem if it is not working Use anyone of below: ComboBox1.Text ComboBox1.SelectedText

I hope first one may solve your error

Upvotes: 1

Related Questions