Solved

Vb 6.0 Two Treeview same movements

Posted on 2015-01-06
10
84 Views
Last Modified: 2015-01-09
Hello all,
I have a point that I am stucked in my project. I couldnt solve and find any solution.
In my project, there are two treeview named "tv" and "tv2". This treeviews are showing different parameters in same order, same hyerarchy, and same number of child node from a same cad document. When I run my project, treeviews are coming collapsed root node. My point is that when ı click one of the treeviews node to expand, at the same time i want the other treeview is also expand in same level, and when ı make scroll down , ı want the other treeview scrolling down.I mean as if one tree view but with different informaation inside. is it posible to do this? My project has one form named "pg" and one module. These are the codes I am requesting your helps:

Module:

Public inertia As inertia
Public CATIA As Object
Public aktif_dokuman As Document
Public anarootproduct As Product
Public sec_prd As Product
Public temp_all_products(1000) As Product
Public altprds As Products
Public altprds_1 As Products
Public altprds_2(1 To 100) As Products
Public altprds_3(1 To 100, 1 To 100) As Products
Public altprds_4(1 To 100, 1 To 100, 1 To 100) As Products
Public altprds_5(1 To 100, 1 To 100, 1 To 100, 1 To 100) As Products
Public oi, orow, ocl, i, J, k, l, m, n, p, r, s, t, u, uu, a, b, c, d, e, f As Integer
Public cp As Integer
Public keystr, nodestr, prdadi, psuffix(30) As String
Public pname As String
Public sd, sd1, sheader As String
Public pd, yd, sbr As Integer
Public s1, s2, s3, s4, s5 As Integer
Public parametreler, dparametreler As Parameters
Public lbl(30) As Control
Public txt(30) As Control
Public leftvl, leftvt, topv As Integer
Public ytxt As Control
Public lastcontrol As Integer
Public parametre As Parameter
Public lastnode As Node
Public lastnode2 As Node
Public sonuc, sprop As Integer
Public pslbl(30) As Control
Public pscheck(30) As Control
Public sleftvl, stopv As Integer
Public frmsonuc As Integer
Public bom_params(30) As String
Public bom_params_count As Integer
Public all_products(2500) As Product
Public all_products_adet(1000) As Integer
Public all_products_partnumber(1000) As String
Public temp_all_products_adet(300) As Integer
Public temp_all_products_partnumber(300) As String
Public temp_all_products_partname(300) As String
Public farkli_part_sayisi As Integer
Public toplam_prd_sayisi As Integer
Public part_adet As Integer
Public list2_siralama As Integer
Public list2_selected As Integer
Public newlist(30) As String
Public bom_list(30) As String
Public bom_list_value As Integer
Public bom_dosyasi As String
Public fnum As Integer
Public fline(30) As String
Public par As String
Public msgsonuc As Integer
Public fxls As Object
Public fxlsname As String
Public wb As Workbook
Public sh As Worksheet
Public tip1, tip2, tip3 As Integer
Public oparametreler(5) As String
Public nofp As Integer


pg form:

Option Explicit

'form üstündeki frameleri transparan yapan deklarasyon aşağıda
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Const RGN_DIFF = 4
Private Const RGN_OR = 2
'form üstündeki frameleri transparan yapan deklarasyon bitti

 'formun hep ustte kalmasını saglıyorum ancak form1.Load olayında bu deklarasyonu cagırmam lazım
Private Declare Function SetWindowPos Lib "user32" _
        (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
         ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Const HWND_TOPMOST = -1
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
'fomun ustte kalmasını saglayan deklarasyon bitti
Dim CATIA As INFITF.Application

Private Sub Form_Load()

'deklarasyonda tanımladıgım fonksıyonu buradan cagırıp form1in her zaman ustte kalmasını saglıyorum
Dim lngRetVal As Long
lngRetVal = SetWindowPos(pg.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
'ustteki always on top kodu burada biter

'form üstündeki framitransparan yapan fonksiyonu çağırdım
'Call MakeFrameTransparent(Frame3, True)

'*******1.Grid satır renklendirmesi yapıyorum
Dim i As Integer
For i = 1 To MSFlexGrid1.Rows - 1 Step 2
MSFlexGrid1.Row = i ' the row you want to highlight
Dim J As Integer
For J = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.Col = J
MSFlexGrid1.CellBackColor = &HFFFFC0    'QBColor(14)
Next J
Next i
'*******1.Grid satır renklendirmesi bitti



'*******1.Grid hucre boyutlamasi yapiyorum
MSFlexGrid1.ColWidth(0) = 2000
MSFlexGrid1.ColWidth(1) = 2000
MSFlexGrid1.ColWidth(2) = 2000
MSFlexGrid1.ColWidth(3) = 2000
MSFlexGrid1.ColWidth(4) = 2000
MSFlexGrid1.ColWidth(5) = 2000
MSFlexGrid1.ColWidth(6) = 2000
MSFlexGrid1.ColWidth(7) = 2000
MSFlexGrid1.ColWidth(8) = 2000
MSFlexGrid1.ColWidth(9) = 2000
MSFlexGrid1.ColWidth(10) = 2000
MSFlexGrid1.ColWidth(11) = 2000
'*******1.Grid hucre boyutlamasi yapiyorum








'*********************************
'BASLANGIC KODU
'*********************************


On Error Resume Next

pg.Top = Screen.Height / 2
pg.Left = Screen.Width / 2
'CATIA objesi alınıyor


Set CATIA = GetObject(, "CATIA.Application")
If Err.Number <> 0 Then
 MsgBox "Programdan önce Catia program çalıştırmalısınız.", vbCritical, "HATA"
End
End If

 
'Açık döküman kontrolu ve açık dökümanın drawing olduğunun kontrolü yapılıyor

If CATIA.ActiveDocument Is Nothing Then
  MsgBox "Açık döküman yok", vbCritical, "HATA"
  End
ElseIf InStr(1, CATIA.ActiveDocument.Name, ".CATProduct") = False Then
  MsgBox "Aktif döküman Product dökümanı olmalı", vbCritical, "HATA"
  End
End If


'Baslangic parametreleri ayarlaniyor
leftvl = 4080
topv = 1000
leftvt = 6300
lastcontrol = -1
bom_list_value = 0

'Combo1.AddItem "Length"
'Combo1.AddItem "Mass"
'Combo1.AddItem "Area"
'Combo1.AddItem "Integer"
'Combo1.AddItem "Real"
'Combo1.AddItem "String"

Set aktif_dokuman = CATIA.ActiveDocument

'Root product aliniyor
Set anarootproduct = aktif_dokuman.Product




'Birinci seviye productlar aliniyor
Set altprds = anarootproduct.Products
cp = altprds.Count



'Ikinci seviye productlar aliniyor
For i = 1 To altprds.Count
Set altprds_2(i) = altprds.Item(i).Products
Next i



'Ucuncu seviye productlar aliniyor
For i = 1 To altprds.Count
For J = 1 To altprds_2(i).Count
Set altprds_3(i, J) = altprds_2(i).Item(J).Products
Next J
Next i



'Dorduncu seviye productlar aliniyor
For i = 1 To altprds.Count
For J = 1 To altprds_2(i).Count
For k = 1 To altprds_3(i, J).Count
Set altprds_4(i, J, k) = altprds_3(i, J).Item(k).Products
Next k
Next J
Next i



'Besinci seviye productlar aliniyor
For i = 1 To altprds.Count
For J = 1 To altprds_2(i).Count
For k = 1 To altprds_3(i, J).Count
For m = 1 To altprds_4(i, J, k).Count
Set altprds_5(i, J, k, m) = altprds_4(i, J, k).Item(m).Products
Next m
Next k
Next J
Next i



'AGAC OLUSTURULUYOR
'1.seviye
tv.Nodes.Add , , "ROOT", anarootproduct.Name
tv2.Nodes.Add , , "ROOT", anarootproduct.Name
For i = 1 To cp
keystr = "Key" + "/" + LTrim(Str(i))
tv.Nodes.Add "ROOT", tvwChild, keystr, altprds.Item(i).PartNumber + "(" + altprds.Item(i).Name + ")"
tv2.Nodes.Add "ROOT", tvwChild, keystr, altprds.Item(i).PartNumber + "(" + altprds.Item(i).Name + ")"
MSFlexGrid1.Col = 0
MSFlexGrid1.Row = i + 1
MSFlexGrid1.Text = altprds.Item(i).PartNumber
'MsgBox altprds.Item(i).PartNumber=
Next i



'2.seviye
For i = 1 To cp
For J = 1 To altprds_2(i).Count
nodestr = "Key" + "/" + LTrim(Str(i))
keystr = "Key" + "/" + LTrim(Str(i)) + "/" + LTrim(Str(J))
tv.Nodes.Add nodestr, tvwChild, keystr, altprds_2(i).Item(J).PartNumber + "(" + altprds_2(i).Item(J).Name + ")"
tv2.Nodes.Add nodestr, tvwChild, keystr, altprds_2(i).Item(J).PartNumber + "(" + altprds_2(i).Item(J).Name + ")"
MSFlexGrid1.Col = 1
MSFlexGrid1.Row = J + 1
MSFlexGrid1.Text = altprds_2(i).Item(J).PartNumber
'MsgBox altprds_2(i).Item(j).PartNumber
Next J
Next i



'3.seviye
For i = 1 To cp
For J = 1 To altprds_2(i).Count
For k = 1 To altprds_3(i, J).Count
nodestr = "Key" + "/" + LTrim(Str(i)) + "/" + LTrim(Str(J))
keystr = "Key" + "/" + LTrim(Str(i)) + "/" + LTrim(Str(J)) + "/" + LTrim(Str(k))
tv.Nodes.Add nodestr, tvwChild, keystr, altprds_3(i, J).Item(k).PartNumber + "(" + altprds_3(i, J).Item(k).Name + ")"
tv2.Nodes.Add nodestr, tvwChild, keystr, altprds_3(i, J).Item(k).PartNumber + "(" + altprds_3(i, J).Item(k).Name + ")"
MSFlexGrid1.Col = 2
MSFlexGrid1.Row = k + 1
MSFlexGrid1.Text = altprds_3(i, J).Item(k).PartNumber
'MsgBox altprds_3(i, j).Item(k).PartNumber
Next k
Next J
Next i



'4.seviye
For i = 1 To cp
For J = 1 To altprds_2(i).Count
For k = 1 To altprds_3(i, J).Count
For m = 1 To altprds_4(i, J, k).Count
nodestr = "Key" + "/" + LTrim(Str(i)) + "/" + LTrim(Str(J)) + "/" + LTrim(Str(k))
keystr = "Key" + "/" + LTrim(Str(i)) + "/" + LTrim(Str(J)) + "/" + LTrim(Str(k)) + "/" + LTrim(Str(m))
tv.Nodes.Add nodestr, tvwChild, keystr, altprds_4(i, J, k).Item(m).PartNumber + "(" + altprds_4(i, J, k).Item(m).Name + ")"
tv2.Nodes.Add nodestr, tvwChild, keystr, altprds_4(i, J, k).Item(m).PartNumber + "(" + altprds_4(i, J, k).Item(m).Name + ")"
MSFlexGrid1.Col = 3
MSFlexGrid1.Row = m + 1
MSFlexGrid1.Text = altprds_4(i, J, k).Item(m).PartNumber
'MsgBox altprds_4(i, j, k).Item(m).PartNumber
Next m
Next k
Next J
Next i


'5.seviye
For i = 1 To cp
For J = 1 To altprds_2(i).Count
For k = 1 To altprds_3(i, J).Count
For m = 1 To altprds_4(i, J, k).Count
For n = 1 To altprds_5(i, J, k, m).Count
nodestr = "Key" + "/" + LTrim(Str(i)) + "/" + LTrim(Str(J)) + "/" + LTrim(Str(k)) + "/" + LTrim(Str(m))
keystr = "Key" + "/" + LTrim(Str(i)) + "/" + LTrim(Str(J)) + "/" + LTrim(Str(k)) + "/" + LTrim(Str(m)) + "/" + LTrim(Str(n))
tv.Nodes.Add nodestr, tvwChild, keystr, altprds_5(i, J, k, m).Item(n).PartNumber + "(" + altprds_5(i, J, k, m).Item(n).Name + ")"
tv2.Nodes.Add nodestr, tvwChild, keystr, altprds_5(i, J, k, m).Item(n).PartNumber + "(" + altprds_5(i, J, k, m).Item(n).Name + ")"
MSFlexGrid1.Col = 4
MSFlexGrid1.Row = n + 1
MSFlexGrid1.Text = altprds_5(i, J, k, m).Item(n).PartNumber
'MsgBox altprds_5(i, j, k, m).Item(n).PartNumber
Next n
Next m
Next k
Next J
Next i



'Set lastnode = tv.Nodes.Item("ROOT")
'Call tv_NodeClick(lastnode)




End Sub


Private Sub tv_NodeClick(ByVal Node As MSComctlLib.Node)
'*********************************
'AGAC UZERINE TIKLAMA KODU
'*********************************
Set lastnode2 = tv2.Nodes.Item("ROOT")
Call tv2_NodeClick(lastnode2)

'Controller siliniyor

On Error Resume Next


i = lastcontrol

For J = 0 To i
pg.Controls.Remove ("lbl" + LTrim(Str(J)))
pg.Controls.Remove ("txt" + LTrim(Str(J)))
Next J


lastcontrol = -1

i = 0
k = 0
J = 0
m = 0
n = 0

s1 = 0
s2 = 0
s3 = 0
s4 = 0
s5 = 0

pd = 0



'Seviyeler aliniyor

i = InStr(1, Node.Key, "/", vbTextCompare)
If i <> 0 Then
J = InStr(i + 1, Node.Key, "/", vbTextCompare)
If J <> 0 Then
k = InStr(J + 1, Node.Key, "/", vbTextCompare)
If k <> 0 Then
m = InStr(k + 1, Node.Key, "/", vbTextCompare)
If m <> 0 Then
n = InStr(m + 1, Node.Key, "/", vbTextCompare)
End If
End If
End If
End If



If i >= 1 Then pd = 1
If J >= 1 Then pd = 2
If k >= 1 Then pd = 3
If m >= 1 Then pd = 4
If n >= 1 Then pd = 5



If i = 0 Then
s1 = 0
End If



If i <> 0 Then
If J = 0 Then
yd = Len(Node.Key) + 1
Else
yd = J
End If
s1 = Val(Mid(Node.Key, i + 1, yd - i - 1))
End If



If J <> 0 Then
If k = 0 Then
yd = Len(Node.Key) + 1
Else
yd = k
End If
s2 = Val(Mid(Node.Key, J + 1, yd - J - 1))
End If

If k <> 0 Then
If m = 0 Then
yd = Len(Node.Key) + 1
Else
yd = m
End If
s3 = Val(Mid(Node.Key, k + 1, yd - k - 1))
End If


If m <> 0 Then
If n = 0 Then
yd = Len(Node.Key) + 1
Else
yd = n
End If
s4 = Val(Mid(Node.Key, m + 1, yd - m - 1))
End If





If n <> 0 Then
s5 = Val(Mid(Node.Key, n + 1, Len(Node.Key) - n))
End If




If pd = 0 Then
Set sec_prd = anarootproduct
End If
If pd = 1 Then
Set sec_prd = altprds_1.Item(s1)
prdadi = altprds_1.Item(s1).Name
End If
If pd = 2 Then
Set sec_prd = altprds_2(s1).Item(s2)
prdadi = altprds_2(s1).Item(s2).Name
End If
If pd = 3 Then
Set sec_prd = altprds_3(s1, s2).Item(s3)
prdadi = altprds_3(s1, s2).Item(s3).Name
End If
If pd = 4 Then
Set sec_prd = altprds_4(s1, s2, s3).Item(s4)
prdadi = altprds_4(s1, s2, s3).Item(s4).Name
End If
If pd = 5 Then
Set sec_prd = altprds_5(s1, s2, s3, s4).Item(s5)
prdadi = altprds_5(s1, s2, s3, s4).Item(s5).Name
End If


'Gizli Labeller olusturuluyor
Set lbl(i) = pg.Controls.Add("VB.TextBox", "lbl" + LTrim(Str(i)), pg)
lbl(i).Top = (topv + 350 * i)
lbl(i).Left = leftvl
lbl(i).Text = pname
lbl(i).Height = 350
lbl(i).Width = 2000
lbl(i).Visible = False
lbl(i).BackColor = &HC3EBFF
lbl(i).Enabled = False

'Textler olusturuluyor
Set txt(i) = pg.Controls.Add("VB.TextBox", "txt" + LTrim(Str(i)), pg)
txt(i).Top = (topv + 350 * i)
txt(i).Left = leftvt
txt(i).Text = parametreler.Item(J + 1).ValueAsString
txt(i).Height = 350
txt(i).Width = 1500
txt(i).Visible = True
lastcontrol = i
i = i + 1

'Ilave bilgiler yaziliyor
Label1.Caption = "Seviye : " & LTrim(Str(pd))
Label2.Caption = "Instance Adi : " & prdadi
Label3.Caption = "Node numarasi : " & LTrim(Str(s1)) & "/" & LTrim(Str(s2)) & "/" & LTrim(Str(s3)) & "/" & LTrim(Str(s4)) & "/" & LTrim(Str(s5))
'Set lastnode = Node



End Sub
Private Sub tv2_NodeClick(ByVal Node As MSComctlLib.Node)
'*********************************
'AGAC UZERINE TIKLAMA KODU
'*********************************


'Controller siliniyor

On Error Resume Next


i = lastcontrol

For J = 0 To i
pg.Controls.Remove ("lbl" + LTrim(Str(J)))
pg.Controls.Remove ("txt" + LTrim(Str(J)))
Next J


lastcontrol = -1

i = 0
k = 0
J = 0
m = 0
n = 0

s1 = 0
s2 = 0
s3 = 0
s4 = 0
s5 = 0

pd = 0



'Seviyeler aliniyor

i = InStr(1, Node.Key, "/", vbTextCompare)
If i <> 0 Then
J = InStr(i + 1, Node.Key, "/", vbTextCompare)
If J <> 0 Then
k = InStr(J + 1, Node.Key, "/", vbTextCompare)
If k <> 0 Then
m = InStr(k + 1, Node.Key, "/", vbTextCompare)
If m <> 0 Then
n = InStr(m + 1, Node.Key, "/", vbTextCompare)
End If
End If
End If
End If



If i >= 1 Then pd = 1
If J >= 1 Then pd = 2
If k >= 1 Then pd = 3
If m >= 1 Then pd = 4
If n >= 1 Then pd = 5



If i = 0 Then
s1 = 0
End If



If i <> 0 Then
If J = 0 Then
yd = Len(Node.Key) + 1
Else
yd = J
End If
s1 = Val(Mid(Node.Key, i + 1, yd - i - 1))
End If



If J <> 0 Then
If k = 0 Then
yd = Len(Node.Key) + 1
Else
yd = k
End If
s2 = Val(Mid(Node.Key, J + 1, yd - J - 1))
End If

If k <> 0 Then
If m = 0 Then
yd = Len(Node.Key) + 1
Else
yd = m
End If
s3 = Val(Mid(Node.Key, k + 1, yd - k - 1))
End If


If m <> 0 Then
If n = 0 Then
yd = Len(Node.Key) + 1
Else
yd = n
End If
s4 = Val(Mid(Node.Key, m + 1, yd - m - 1))
End If





If n <> 0 Then
s5 = Val(Mid(Node.Key, n + 1, Len(Node.Key) - n))
End If




If pd = 0 Then
Set sec_prd = anarootproduct
End If
If pd = 1 Then
Set sec_prd = altprds_1.Item(s1)
prdadi = altprds_1.Item(s1).Name
End If
If pd = 2 Then
Set sec_prd = altprds_2(s1).Item(s2)
prdadi = altprds_2(s1).Item(s2).Name
End If
If pd = 3 Then
Set sec_prd = altprds_3(s1, s2).Item(s3)
prdadi = altprds_3(s1, s2).Item(s3).Name
End If
If pd = 4 Then
Set sec_prd = altprds_4(s1, s2, s3).Item(s4)
prdadi = altprds_4(s1, s2, s3).Item(s4).Name
End If
If pd = 5 Then
Set sec_prd = altprds_5(s1, s2, s3, s4).Item(s5)
prdadi = altprds_5(s1, s2, s3, s4).Item(s5).Name
End If


'Gizli Labeller olusturuluyor
Set lbl(i) = pg.Controls.Add("VB.TextBox", "lbl" + LTrim(Str(i)), pg)
lbl(i).Top = (topv + 350 * i)
lbl(i).Left = leftvl
lbl(i).Text = pname
lbl(i).Height = 350
lbl(i).Width = 2000
lbl(i).Visible = False
lbl(i).BackColor = &HC3EBFF
lbl(i).Enabled = False

'Textler olusturuluyor
Set txt(i) = pg.Controls.Add("VB.TextBox", "txt" + LTrim(Str(i)), pg)
txt(i).Top = (topv + 350 * i)
txt(i).Left = leftvt
txt(i).Text = parametreler.Item(J + 1).ValueAsString
txt(i).Height = 350
txt(i).Width = 1500
txt(i).Visible = True
lastcontrol = i
i = i + 1


'Ilave bilgiler yaziliyor
Label1.Caption = "Seviye : " & LTrim(Str(pd))
Label2.Caption = "Instance Adi : " & prdadi
Label3.Caption = "Node numarasi : " & LTrim(Str(s1)) & "/" & LTrim(Str(s2)) & "/" & LTrim(Str(s3)) & "/" & LTrim(Str(s4)) & "/" & LTrim(Str(s5))
'Set lastnode2 = Node



End Sub

Private Function countstr(ByVal countstrstr As String, ByVal countstrstrc As String)

'*********************************
'STRING ICINDE SAYMA FONKSIYONU
'*********************************

Dim countstri, countstrj As Integer
countstrj = 0
For countstri = 1 To Len(countstrstr)
If Mid(countstrstr, countstri, 1) = countstrstrc Then countstrj = countstrj + 1
Next
countstr = countstrj

End Function

Private Function instrl(ByVal instrlstr As String, ByVal instrlfstr As String)


'*********************************
'STRING ICINDE SONDAN ARAMA FONKSIYONU
'*********************************

Dim instrli As Integer
Dim instrlpos As Integer
Dim instrlmax As Integer

On Error Resume Next
instrlpos = 0
For instrli = 1 To Len(instrlstr)
instrlpos = InStr(instrli, instrlstr, instrlfstr, vbTextCompare)
If instrlmax < instrlpos Then instrlmax = instrlpos
Next
instrl = instrlmax
End Function

Private Sub MSFlexGrid1_DblClick()
'Bu fonksiyon sadece flexgrid hücrelerine tiklanildiginda bir text box yardimiyla iceriginin editlenmesi saglanabiliyor
    GridEdit Asc(" ")
End Sub

Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
'Bu fonksiyon sadece flexgrid hücrelerine tiklanildiginda bir text box yardimiyla iceriginin editlenmesi saglanabiliyor
    GridEdit KeyAscii
End Sub
Private Sub GridEdit(KeyAscii As Integer)
    ' Position the TextBox over the cell.
    'Bu fonksiyon sadece flexgrid hücrelerine tiklanildiginda bir text box yardimiyla iceriginin editlenmesi saglanabiliyor
    Text1.Left = MSFlexGrid1.CellLeft + MSFlexGrid1.Left
    Text1.Top = MSFlexGrid1.CellTop + MSFlexGrid1.Top
    Text1.Width = MSFlexGrid1.CellWidth
    Text1.Height = MSFlexGrid1.CellHeight
    Text1.Visible = True
    Text1.SetFocus

    Select Case KeyAscii
        Case 0 To Asc(" ")
            Text1.Text = MSFlexGrid1.Text
            Text1.SelStart = Len(Text1.Text)
        Case Else
            Text1.Text = Chr$(KeyAscii)
            Text1.SelStart = 1
    End Select
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As _
    Integer)
    'Bu fonksiyon sadece flexgrid hücrelerine tiklanildiginda bir text box yardimiyla iceriginin editlenmesi saglanabiliyor
    Select Case KeyCode
        Case vbKeyEscape
            ' Leave the text unchanged.
            Text1.Visible = False
            MSFlexGrid1.SetFocus

        Case vbKeyReturn
            ' Finish editing.
            MSFlexGrid1.SetFocus

        Case vbKeyDown
            ' Move down 1 row.
            MSFlexGrid1.SetFocus
            DoEvents
            If MSFlexGrid1.Row < MSFlexGrid1.Rows - 1 Then
                MSFlexGrid1.Row = MSFlexGrid1.Row + 1
            End If

        Case vbKeyUp
            ' Move up 1 row.
            MSFlexGrid1.SetFocus
            DoEvents
            If MSFlexGrid1.Row > MSFlexGrid1.FixedRows Then
                MSFlexGrid1.Row = MSFlexGrid1.Row - 1
            End If

    End Select
End Sub
Private Sub MSFlexGrid1_GotFocus()
'Bu fonksiyon sadece flexgrid hücrelerine tiklanildiginda bir text box yardimiyla iceriginin editlenmesi saglanabiliyor
    If Text1.Visible Then
        MSFlexGrid1.Text = Text1.Text
        Text1.Visible = False
    End If
End Sub
0
Comment
Question by:hakanogu
  • 6
  • 4
10 Comments
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
Please attach a zip file containing all your project files.
0
 

Author Comment

by:hakanogu
Comment Utility
Now I attached..
V4.zip
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
The zip file is missing module1.bas
0
 

Author Comment

by:hakanogu
Comment Utility
Sorry I attached again.
V4.zip
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
No problem. I have to leave for a couple of hours but I'll get back to you.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
I can't run your project because I don't have your INFITF application. However if the two treeviews were created in the same order then add this in your tv_NodeClick event.

tv2.Nodes(Node.Index).Selected = True

Try that and let me know what happens.
0
 

Author Comment

by:hakanogu
Comment Utility
Actually, now it succeeded to effect the other tv2 treeview kontrol , but it is not at the same time , ı have to click sub nodes to open the other tv2 treeview kontrol and when ı collapse the tv treeview,   tv2 treeview is staying same situation.
0
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
Comment Utility
Try this little demo. I think it does what you want.
Q-28591561.zip
0
 

Author Closing Comment

by:hakanogu
Comment Utility
Thank you Martin,
It worked.!
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now