MSHFlex Grid内的ComboBox [英] ComboBox inside MSHFlex Grid

查看:106
本文介绍了MSHFlex Grid内的ComboBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!这是我在VB论坛上的第一篇文章。我试图在VB 6.0中完成一项任务,目前它工作正常。我正在做的是在运行时在MSHFlex Grid的每一行中添加ComboBoxes,如下所示:

Hello! This is my first post to the VB forum. I've tried to complete a task in VB 6.0 and for the time being, it works fine. What I am doing is to add ComboBoxes in each row of MSHFlex Grid on run time and as the following:

这就是现在的样子。其次,ComboBoxes附加行如下:

This is how it looks like now. Secondly, the ComboBoxes are attached with the rows as follows:

最后我想要的是ComboBox将在第三列中,并且在给定输入时它将附加到MSHFlex网格的每一行。我不确定我做错了什么或错过了什么,这是我到目前为止所做的:

Finally what I want is the ComboBox will be in the third column and it'll be attached to the each rows of the MSHFlex grid when input given. I am not sure what I am doing wrong or anything missed, this is what I've done so far:

Private Sub Form_Load()
SetupCombo

    With Combo2
        .Visible = True
        .AddItem "Denim"
        .AddItem "Pringles"
        .AddItem "Bounty"
    End With
    
    With MSHFlexGrid2
        For i = 0 To MSHFlexGrid2.Cols - 1
            .RowHeight(i) = Combo2.Height
        Next
    End With
End Sub

Private Sub btnAdd_Click()
 '**Bind ID and Name From The TextBoxes in The MSHFlex Grid - Starts**
     With MSHFlexGrid2
        MSHFlexGrid2.AddItem (txtID.Text) & vbTab & (txtName.Text)
     End With
'**Bind ID and Name From The TextBoxes in The MSHFlex Grid - Ends**

SetupCombo
End Sub

Private Sub MSHFlexGrid2_Click()
    If MSHFlexGrid2.Col < 1 Or MSHFlexGrid2.Row < 1 Then Exit Sub
    SetupCombo
End Sub

Private Sub SetupCombo()
'**Setting Up The ComboBox By Positioning and Sizing It Over The MSHFlex Grid Cell - Starts**
 
Dim posL As Single
Dim posT As Single
Dim posW As Single
Dim posH As Single
  
    With MSHFlexGrid2.Container
        posL = .ScaleX(MSHFlexGrid2.CellLeft, vbTwips, .ScaleMode)
        posT = .ScaleY(MSHFlexGrid2.CellTop, vbTwips, .ScaleMode)
        posW = .ScaleX(MSHFlexGrid2.CellWidth, vbTwips, .ScaleMode)
        posH = .ScaleY(MSHFlexGrid2.CellHeight, vbTwips, .ScaleMode)
    End With
  
    With Combo2
        .Move MSHFlexGrid2.Left + posL, MSHFlexGrid2.Top + posT, posW
        .Visible = True
        .SetFocus
    End With
    
'**Setting Up The ComboBox By Positioning and Sizing It Over The MSHFlex Grid Cell - Ends**
End Sub


这是我的第一个VB项目。我希望专家能够提出一些有价值的想法或建议来完成上述任务,或者是否需要进行任何改进。谢谢。




This is my first VB project. I would expect some valuable ideas or suggestions from the expert to complete the above task or if there is any improvement required. Thanks.


推荐答案

是的但是这个论坛适用于过去千禧年(2000年之前)的技术。 

Yea but this forum is not meant for technologies from the past  millennium (before 2000). 

当前的VB版本15是免费软件,你也可以这样做至少提高80%的可靠性。 

Current VB version 15 is freeware and you can do the same with at least 80% more reliability. 

https:// www。 visualstudio.com/downloads/

您看到VB15在Visual Studio 2017中,版本6在Visual Studio 1998中,然后大部分写为'98

You see that VB15 is in visual Studio 2017, version 6 was in Visual Studio 1998 then mostly written as '98

如果它不适合当前的开发,但你想保持版本6运行,你可以同样访问论坛 

If it is not for current development but you want to keep version 6 running you can visit a forum likewise 

http://www.vbforums.com/forumdisplay.php?1-Visual-Basic-6-and-Earlier


这篇关于MSHFlex Grid内的ComboBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆