|
I am creating an form application that creates an excel app and workbook then returns the cell address selected by the user, however the textbox (selectedRangeTextBox) located in my application is not being updated with the address. Furthermore, trying to update any part of the form from the excel driven event does nothing. Please help!!
'This code is in my module.vb
Imports System.IO
Imports System.Globalization
Imports Excel = Microsoft.Office.Interop.Excel
Module ExcelEvents
Friend EventDel_SelectionChange As Excel.DocEvents_SelectionChangeEventHandler
Public Sub SelectionChange(ByVal cell As Excel.Range)
'All these fail to work.
selectDataSeriesForm.selectedRangeTextBox.Text = cell.Address
selectDataSeriesForm.selectedRangeTextBox.Enabled =False
selectDataSeriesForm.Focus()
selectDataSeriesForm.Close()
End Sub
End Module
'This code is contianed within my form class. excApp and iexcSh1 are the
'Excel.Application and Excel.Worksheet objects defined elsewhere
Private Sub selectDataSeriesForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
excApp.Visible = True
EventDel_SelectionChange = New Excel.DocEvents_SelectionChangeEventHandler(Addres sOf SelectionChange)
AddHandler iexcSh1.SelectionChange, EventDel_SelectionChange
End Sub
|