![]() |
| ||
| Object variable or With block variable not set hello to everyone i am working with vb6 & mapobjects2.4 and also i wrote code for "To select features based on an SQL expression" and i got an error as "Object Variable or With block Variable not set" .i want solution for this this problem code: Dim recset As New MapObjects2.Recordset Dim LabelPlacer As New MapObjects2.LabelPlacer Dim g_symSelection As MapObjects2.Symbol Private Sub Form_Load() Dim r1 As New Rectangle r1.Left = -117.183964079772 r1.Right = -117.160018438746 r1.Top = 34.047951088234 r1.Bottom = 34.0285801368372 r1.ScaleRectangle 0.75 Set Map1.Extent = r1 'Map1.Layers(0).Symbol.Color = moNavy Dim fnt1 As New StdFont fnt1.Name = "Times new roman" fnt1.Bold = False Set Map1.Layers(0).Renderer = LabelPlacer LabelPlacer.Field = "NAME" LabelPlacer.DrawBackground = True LabelPlacer.DefaultSymbol.Height = Map1.FullExtent.Height / 150 Set LabelPlacer.DefaultSymbol.Font = fnt1 LabelPlacer.AllowDuplicates = False LabelPlacer.ValueField = "CFCC" LabelPlacer.ValueCount = 1 LabelPlacer.Value(0) = "A31" fnt1.Bold = True Set LabelPlacer.Symbol(0).Font = fnt1 LabelPlacer.Symbol(0).Height = Map1.FullExtent.Height / 100 LabelPlacer.MaskLabels = True LabelPlacer.MaskColor = Map1.BackColor With Map1 If Not .Layers.Count = 1 Then End .Layers(0).Symbol.Color = moDarkGreen End With With Combo1 Dim fldLyr1 As MapObjects2.Field For Each fldLyr1 In Map1.Layers(0).Records.Fields If fldLyr1.Type < 20 Then .AddItem fldLyr1.Name End If Next fldLyr1 .ListIndex = 0 End With With Combo2 .AddItem "=" .AddItem "<" .AddItem ">" .AddItem "<=" .AddItem ">=" .AddItem "Like" .ListIndex = 0 End With Combo3.Text = "<Field Values>" Call ListValues1 Set g_symSelection = New MapObjects2.Symbol With g_symSelection .SymbolType = Map1.Layers(0).Symbol.SymbolType .Color = moYellow End With end sub Private Sub Map1_AfterLayerDraw(ByVal index As Integer, ByVal canceled As Boolean, ByVal hDC As stdole.OLE_HANDLE) If index > 0 Then Exit Sub Dim strExpression1 As String If Map1.Layers(0).Records.Fields(Combo1.List(Combo1.ListIndex)).Type = moString Then -------> strExpression1 = Combo1.List(Combo1.ListIndex) & " " & Combo2.List(Combo2.ListIndex) & " '" & Combo3.Text & "'" Else strExpression1 = Combo1.List(Combo1.ListIndex) & " " & Combo2.List(Combo2.ListIndex) & " " & Combo3.Text End If Dim recSelection1 As MapObjects2.Recordset Set recSelection1 = Map1.Layers(0).SearchExpression(strExpression1) If Not recSelection1.EOF Then Map1.DrawShape recSelection1, g_symSelection End If Set recSelection1 = Nothing End Sub Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Map1.Extent = Map1.TrackRectangle Else Map1.Pan End If End Sub Private Sub Map1_BeforeLayerDraw(ByVal index As Integer, ByVal hDC As stdole.OLE_HANDLE) Map1.Refresh End Sub Private Sub Combo1_Click() If Map1.Visible = True Then Call ListValues1 End If End Sub Private Sub ListValues1() If Len(Combo1.List(Combo1.ListIndex)) > 0 Then Dim recLyr As MapObjects2.Recordset Set recLyr = Map1.Layers(0).Records Dim strName As String strName = Combo1.List(Combo1.ListIndex) Combo3.Clear Do While Not recLyr.EOF Combo3.AddItem recLyr.Fields(strName).ValueAsString recLyr.MoveNext Loop End If End Sub Private Sub cmbSel_Click() If cmbSel.ListIndex = 0 Then Map1.Visible = True legend1.setMapSource Map1 legend1.LoadLegend True Map1.Extent = Map1.FullExtent End If End Sub Advance thanks for giving solution for my problem |
| ||
| Re: Object variable or With block variable not set Try to register the component with windows using REGSVR32 key before using in project. |
| All times are GMT -4. The time now is 3:37 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC