How To set the control's ZOrder property

bergie

Member
Joined
Jun 22, 2004
Messages
12
Programming Experience
3-5
In VB6, if we want to put a control on another one, we can set the zorder to be 0. but in VB.net i can't find this property. but i find one method(updateZorder), so there must be a method to set the zorder. anyone knows? thank you!
 

bergie

Member
Joined
Jun 22, 2004
Messages
12
Programming Experience
3-5
thank you , but i've already used that, maybe it is not useful. or i have some mistake?? i want to write text in MSFlexGrid using a textbox,just like thsi. can you help me?
VB.NET:
Private Sub Grid1_KeyPressEvent(ByVal sender As Object, ByVal e As AxMSFlexGridLib.DMSFlexGridEvents_KeyPressEvent) Handles Grid1.KeyPressEvent
		'Move the text box to the current grid cell :
		Text1.Top = Grid1.CellTop + Grid1.Top
		Text1.Left = Grid1.CellLeft + Grid1.Left
		'Save the position of the grids Row and Col for later"
		gRow = Grid1.Row
		gCol = Grid1.Col
		'Make text box same size as current grid cell:
		Text1.Width = Grid1.CellWidth
		Text1.Height = Grid1.CellHeight
		'Transfer the grid cell text:
		'Text1.Text = Grid1.Text
		'Show the text box:
		Text1.Visible = True
		Text1.BringToFront()
		'Text1.SendToBack()
		Text1.Focus()
		'Redirect this KeyPress event to the text box:
		'If e.keyAscii <> ASC_ENTER Then
		'	SendKeys.Send(Str(e.keyAscii))
		'End If
	End Sub
	'Private Sub Text1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Text1.KeyPress
	'	If e.KeyChar = Chr(ASC_ENTER) Then
	'		Grid1.Parent = Grid1
	'		Grid1.Focus() 'Set focus back to grid, see Text_LostFocus
	'	End If
	'End Sub
	Private Sub Text1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Text1.LostFocus
		Dim tmpRow As Integer
		Dim tmpCol As Integer
		'Save current setting of Grid Row and col, This is needed only if 
		'the focus is set somewhere else in the Grid
		tmpRow = Grid1.Row
		tmpCol = Grid1.Col
		'Set Row and Col back to what they were before Text1_LostFocus
		Grid1.Row = gRow
		Grid1.Col = gCol
		Grid1.Text = Text1.Text 'Transfer text back to grid
		'Text1.SelStart = 0
		Text1.Visible = False  'Disable text box
		'Return row and Col contents:
		Grid1.Row = tmpRow
		Grid1.Col = tmpCol
  

	End Sub
	Private Sub Grid1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Grid1.GotFocus
		'Label1.BringToFront()
	End Sub
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
Any reason you're using the MsFlexGrid as opposed to the DataGrid control? In addition to being more powerful, the DataGrid control is a native .NET control as opposed to a COM component and therefore doesn't require an interop layer.

Sorry, I don't have experience with the FlexGrid and can't help with your problem, just thought I'd throw that suggestion out there. ;)
 

bergie

Member
Joined
Jun 22, 2004
Messages
12
Programming Experience
3-5
telling the truth that i don't know it's strongpoints, but i find a programme just using it, and my work is to continue that programme. thx you all. glad to meet you :) i will try myself, and if it is ok, i will paste it out to study each other.
 
Top Bottom