excel - Loop through selected cells in VB.net -


I have just started learning Vb.net in VBA, I can loop through selected cells like this And change the case for all the cells in the selection

  Dim the range for each C in the selection if c.HasFormula = False then c.value = UCase (c.value) End if Next  

How can I get it in VB.Net, keeping in mind that I do not already know how many cells are selected

Try it properly I want a user to select some cells in a Using DataGridView . When the user clicks on the "Show selected" button, then goes through each selected cell for each loop. Public class form 1 dim grid new datagrid view selected as new dimensional selection as new label string private sub form 1_load (sender as object in the form of sender, and eventRG As the sender) as the dim selection mebase. Load 'setup DataGrid View Grid Choose. Column.ed ("column A", "A") grid selection. Column.ed ("column B", "B") grid selection. Columns Add ("Colmisi", "C") Grid Selection. Column. Update ("Column D", "D") Grid Selection. Rao Add (6) Grid Selection Place = New point (0, 0) Grid selection to select the AutoSize = True 'Setup button Select the dirty btnShow as new button Show btnShow.Text = "Show Show" btnShow.Location = New Point (0, 250 ) BtnShow.AutoSize = True AddHandler btnShow.Click, address of btnShow_Click 'Setup label to display selection lblSelection.Text = Nothing LLB selection. Location = New point (0, 300) LLL selection. Make me control for autosis = tromps. Control Add-Range ({Grid Selection, BTNSShow, LLL Selection}) and all sub btnshow_click () 'Reset selection list. Selection through each selected cell = nothing 'loop. For each room in the grid selection. In grid selection Selected column in the form of a dim column string = cell Opening column Header text in the form of a dim row string = cell RowIndex.ToString () Add cell to the selection list. Selection = IIf (Selection = None, Selection, Selection + ",") + Column + Row Next 'Show Selection List

< / P>


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -