|
Hello.
I´m a VB programing and I´m from Brazil.
I need some help with DBF database. I already created a DBF code in VB, but I don´t know how to set size of a field(columns).
For example: When I created a DBF, it came with fields with width 20 and type adNumeric, but I want it with width the size equal 5 and type adNumeric.
How can I do it in VB6?
below it´s my code to generate a DBF
Function fCriaDBF(sPATH As String, sNome As String, vCampos As Variant) As Boolean
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Dim i As Integer
Set cat = New ADOX.Catalog
cat.ActiveConnection = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=c:\tmp;Extended Properties=Dbase 5.0;"
Set tbl = New ADOX.Table
With tbl
.Name = sNome
Set .ParentCatalog = cat
With .Columns
For i = 0 To UBound(vCampos)
.Append vCampos(i), adNumeric, CLng(5)
.Item(vCampos(i)).NumericScale = 0
.Item(vCampos(i)).DefinedSize = CByte(5)
.Item(vCampos(i)).Precision = CLng(5)
Next
End With
End With
cat.Tables.Append tbl
Set cat = Nothing
end function
Anyone Help me!
Tanks
-- modified at 7:00 Wednesday 24th May, 2006
|
|
|
|
|
Hi,
Plz tell me how can i, firstly, add the data from the datagrid to the dataset. Secondly, how can i update the data from the datagrid to the dataset. i.e. all the settings or updations must be saved to the dataset.
Thanks.
Plz anybody answer to my question.
|
|
|
|
|
If you bind the datagrid to the dataset, and make sure that the ReadOnly property of the datagrid is set to false, the dataset is updatable by the datagrid. Then you should write
DataAdapter1.Update(DataSet1)
DataSet1.AcceptChanges()
to have the changes take effect in the database....
|
|
|
|
|
|
Can someone tell me what is wrong with this code? The error I'm getting is: "Error #380 was generated by ListItems. Invalid Property value."
I’m trying to place a database table’s information on a listview control. Where the column names are the table’s field names.
Here is the code:
Private Sub List_Fields_In_Table(cnnDB As ADODB.Connection, strTable As String)
On Error GoTo List_Fields_In_Table_Err
Dim itmX As ListItem
Dim clmX As ColumnHeader
Dim Idx As Integer
Dim fld As ADODB.Field
lvTblCols.ListItems.Clear
Set rstSchema = New ADODB.Recordset
strSQL = "SELECT " & strTable & ".* FROM " & strTable & ";"
'Retrieve table field schema
rstSchema.Open strTable, cnnDB, , , adCmdTable
lvTblCols.ColumnHeaders.Clear
lvTblCols.ListItems.Clear
lvTblCols.View = lvwReport
lvTblCols.BorderStyle = ccFixedSingle
Idx = 1
For Each fld In rstSchema.Fields
'Place the Field name on the column, with an index to the column.
'Name the column with the fld.name
Set clmX = lvTblCols.ColumnHeaders.Add(Idx, fld.Name, fld.Name)
'Place the value in the field under the its field name
Set itmX = lvTblCols.ListItems.Add(Idx, fld.Name, fld.Value)
'I get the error here.
itmX.SubItems(lvTblCols.ColumnHeaders(fld.Name).SubItemIndex) = fld.Value
Idx = Idx + 1
Next fld
List_Fields_In_Table_Exit:
On Error Resume Next
rstSchema.Close
Set rstSchema = Nothing
Exit Sub
List_Fields_In_Table_Err:
Msg = "Error in frmPictures - List_Fields_In_Table subroutine. " & vbCr & _
"Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & vbCr & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
Resume List_Fields_In_Table_Exit
End Sub
This is just a variable version of:
Make sure ListView control is in report view.
ListView1.View = lvwReport
' Add three columns.
ListView1.ColumnHeaders.Add , "Name", "Name"
ListView1.ColumnHeaders.Add , "Address", "Address"
ListView1.ColumnHeaders.Add , "Phone", "Phone"
' Add ListItem objects to the control.
Dim itmX As ListItem
' Add names to column 1.
Set itmX= ListView1.ListItems.Add(1, "Mary", "Mary")
' Use the SubItemIndex to associate the SubItem with the correct
' ColumnHeader. Use the key ("Address") to specify the right
' ColumnHeader.
itmX.SubItems(ListView1.ColumnHeaders("Address").SubItemIndex) _
= "212 Grunge Street"
' Use the ColumnHeader key to associate the SubItems string
' with the correct ColumnHeader.
itmX.SubItems(ListView1.ColumnHeaders("Phone").SubItemIndex) _
= "555-1212"
Set itmX = ListView1.ListItems.Add(2, "Bill", "Bill")
itmX.SubItems(ListView1.ColumnHeaders("Address").SubItemIndex) _
= "101 Pacific Way"
itmX.SubItems(ListView1.ColumnHeaders("Phone").SubItemIndex) _
= "555-7879"
Set itmX= ListView1.ListItems.Add(3, "Susan", "Susan")
itmX.SubItems(ListView1.ColumnHeaders("Address").SubItemIndex) = _
"800 Chicago Street"
itmX.SubItems(ListView1.ColumnHeaders("Phone").SubItemIndex) = _
"555-4537"
Set itmX= ListView1.ListItems.Add(4, "Tom", "Tom")
itmX.SubItems(ListView1.ColumnHeaders("Address").SubItemIndex) _
= "200 Ocean City"
itmX.SubItems(ListView1.ColumnHeaders("Phone").SubItemIndex) = _
"555-0348"
Please help,
Quecumber256
|
|
|
|
|
I am writing a web browser that will only show one page, im trying to lock down as many functions as possible. right now i have it so i have to hit go to bring me to the page, but i want to get rid of that and have the page open when the program does.
Also i wanted it to auto fill out a name and password feild for me. If any one can help id appreciate it thanks. Here is my code so far...
Public Class form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents AxWebBrowser1 As AxSHDocVw.AxWebBrowser
Friend WithEvents txtUrl As System.Windows.Forms.TextBox
Friend WithEvents btnGo As System.Windows.Forms.Button
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(form1))
Me.AxWebBrowser1 = New AxSHDocVw.AxWebBrowser
Me.txtUrl = New System.Windows.Forms.TextBox
Me.btnGo = New System.Windows.Forms.Button
CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'AxWebBrowser1
'
Me.AxWebBrowser1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.AxWebBrowser1.Enabled = True
Me.AxWebBrowser1.Location = New System.Drawing.Point(0, 40)
Me.AxWebBrowser1.OcxState = CType(resources.GetObject("AxWebBrowser1.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxWebBrowser1.Size = New System.Drawing.Size(1284, 961)
Me.AxWebBrowser1.TabIndex = 0
'
'txtUrl
'
Me.txtUrl.Location = New System.Drawing.Point(8, 8)
Me.txtUrl.Name = "txtUrl"
Me.txtUrl.Size = New System.Drawing.Size(336, 20)
Me.txtUrl.TabIndex = 1
Me.txtUrl.Text = "sage03/fsdatacollection/login.asp"
'
'btnGo
'
Me.btnGo.Location = New System.Drawing.Point(352, 8)
Me.btnGo.Name = "btnGo"
Me.btnGo.Size = New System.Drawing.Size(40, 24)
Me.btnGo.TabIndex = 2
Me.btnGo.Text = "Go"
'
'form1
'
Me.AcceptButton = Me.btnGo
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(1284, 1002)
Me.ControlBox = False
Me.Controls.Add(Me.btnGo)
Me.Controls.Add(Me.txtUrl)
Me.Controls.Add(Me.AxWebBrowser1)
Me.Cursor = System.Windows.Forms.Cursors.Arrow
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "form1"
Me.Text = "Sytline Log-In"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
AxWebBrowser1.Navigate(txtUrl.Text)
End Sub
Private Sub AxWebBrowser1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxWebBrowser1.Enter
AxWebBrowser1.LocationURL("sage03 / fsdatacollection / login.aps")
End Sub
End Class
Timothy Groleau
TJGroleau@charter.net
|
|
|
|
|
|
?? ??
What does it mean?!!
|
|
|
|
|
Hi, I am programming in vb6 a program that deals with huge arrays which need to be saved/loaded. I used a simple for-next and Print# to print any item in the array to the file and Input# to load it.
But it is too slow... I need a better algorithm/method to do this if available...
could you please help me out?
|
|
|
|
|
I can't believe a 20min process now is done only .6sec!!!!!
Print #1, Join(a,",")
to save and split to load..
|
|
|
|
|
In C# I can do the following:
<br />
int nSize = 24;<br />
object[] pObjArray = new object[nSize];<br />
How do I do the same in VB.NET? Thanks.
|
|
|
|
|
Integer nSize = 24
Object() pObjArray = new Object() {nSize}
|
|
|
|
|
Wooster2006 wrote: Integer nSize = 24
Object() pObjArray = new Object() {nSize}
This is not correct.
This creates an array containing 1 element whose value is 24.
|
|
|
|
|
Dim nSize As Integer = 24<br />
Dim pObjArray(nSize) As Object<br />
<br />
'// And to test it:<br />
pObjArray(24) = "Test"<br />
MsgBox(CType(pObjArray(24), String))
There you go!
-- modified at 11:38 Tuesday 23rd May, 2006
|
|
|
|
|
j-on wrote: Dim nSize As Integer = 24
Dim pObjArray(nSize) As Object
Not quite right.
This array contains 25 elements. Not 24.
In VB.NET, the value that you use to set the array size does not represent the "Capacity" of the array like how it's done in C#. It represents the max "Index" of the array. And remember that arrays in VB.NET are zero based. So, if you count the elements from 0 to 24, you have a total of 25 elements. What you want to do is this instead.
Dim nSize As Integer = 24<br />
Dim pObjArray(nSize - 1) As Object
This is one of the major difference between C# and VB.NET's handling of arrays.
-- modified at 18:51 Tuesday 23rd May, 2006
|
|
|
|
|
Hello Blue Bird.
The first 2 responses that you received were not quite correct. Please look at my responses to them.
The following C# code...
int nSize = 24;
object[] pObjArray = new object[nSize];
Will look like this in VB.NET...
Dim nSize As Integer = 24
Dim pObjArray(nSize - 1) As Object
The big difference here is that the array initializer in VB.NET represents the largest index (ie: upper bound) and not the capacity of the array. That's why you should tack on a "-1" as shown above.
You can also generate an array like this via the "ReDim" statement.
Dim pObjArray() As Object ' Array not created yet.<br />
ReDim pObjArray(nSize - 1) ' This create a new array.<br />
ReDim pObjArray(1) ' This creates a new array having 2 elements.
You can also create an array and initialize it at the same time like this...
Dim pObjArray() As Object = {1, 2, 3}
Or like this...
Dim pObjArray() As Object<br />
pObjArray = New Object() {1, 2, 3}
I hope this helps!
|
|
|
|
|
Our Instant VB C# to VB.NET converter produces:
Dim nSize As Integer = 24
Dim pObjArray As Object() = New Object(nSize - 1){}
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
|
|
|
|
|
DEAR CANDIDATES,
tHIS IS MY WARNING MESSAGE ABOUT WWW.YARDI.COM -A SOFTWARE COMPANY AT PUNE.THOSE PEOPLE ARE MAKING FOOL TO ALL NEW DEVELOPERS.
THEY ARE TAKING EXAM ON VB.NET AND SQL.QUESTIONS ARE SIMPLE.
BUT IN TECHNICAL INTERVIEW THEY ARE PRESSURISING CANDIDATES TO JOIN AS TRAINEE ON VBSCRIPT-MANUAL TESTING.SALARY IS JUST RS 6500/- PER MONTH GROSS WITH 2 YEARS BOND.
FEW FOUL QUESTIONS ON SQL IN INTERVIEW:
1.IS THIS SQL OR STORED PROCEDURE:
DECLARE @EMP INT
SET @EMP=(SELECT AVG(QTY) FROM EMPLOYEE)
SELECT * FROM EMPLOYEE WHERE EMP_ID=@EMP
ANS: IT IS AN STORED PROCEDURE-SHOCKED ! ANSWERED BY PROJECT LEADER
2. HOW DO YOU CREATE CRYSTAL REPORT FOR EACH TAG OF AN XML FILE.
CAN YOU ANSWER SUCH QUESTIONS .WELL IT'S MEAN YOU DONT KNOW.
SO JOIN AS VBSCRIPT DEVELOPER WHICH IS A PART OF VB.NET------WAOOOO?
3. STATE DIFFERENT TYPE OF STORED PROCEDURE?
ANSWER THREE AS PER MICROSOFT.
BUT BY YARDI GROUP ANSWER FOUR.
EXTENDED IMPLICIT STORED PROCEDURE.
CAN YOU EXPLAIN WHAT EXACTLY IT IS!
IF YOU STILL DONT BELIEVE YOU CAN GO SUCH FUNDOO PEOPLE IN YARDI.
I SAY FOOL HARDY.
ADDRESS:
2 ND FLOOR SIGMA HOUSE,
OFF. SENAPATI BAPPAT ROAD,
PUNE.
Encryption and decryption with .NET
|
|
|
|
|
Hi all!
My issue is very simple and is as follows:
Is there any way to hide controls just in Design View? Let me explain my situation. I'm currently working on an app that will have an Outlook 2003 look and feel with an outlook navigator panel on the screen's left with a contents panel on the right. Based upon the user's selection from the navigator panel, the contents panel will need to display the appropriate controls, data, etc. I have found no easy way to hide a particular set of controls from the contents panel (assigned to one choice from the navigator panel) so I can begin work easier on the next collection of controls for the contents panel (based upon a new selection from the navigator).
Any ideas?
|
|
|
|
|
I'm not entirely sure about what you are trying to accomplish but it seems like you are looking for the Visible property that makes controls visible or not based on the selection.
|
|
|
|
|
Let me phrase it another way:
Suppose I had four buttons with each button assigned one specific panel that should be displayed when its button is clicked. Each panel would have its own set of controls and the like about it. What I'm asking is not how to hide certain controls (or an entire panel) via code but rather how to do it in the Design View as I am working on designing the panels.
As it is right now, what I have is the following: a panel manager with four subpanels (buttons if you will) that are used to select what it is you would like to view in a main, contents panel which takes up most of the screen. This contents panel needs to be updated with the appropriate controls and such based upon what the user chose to view from the panel manager. Think of it like a webpage with frames where the left, thin frame holds links that when clicked display the result in the main, larger frame. My problem is that I can't design the UI effectively when I have nine million controls sitting on the screen and I have no way of hiding them so I can work on the next "button"'s content.
|
|
|
|
|
As far as I know there is no way to hide the controls in the design view...
But once I had to do some panel work like what you mentioned... I designed each panel in a separate form and when I was sure that everything is okay, I copy&pasted all in a single form...
|
|
|
|
|
There might be two different ways, Try using tabs, one tab for each subset of controls, or try child forms, Forms within forms, much like documents in a word processor.
Either way allows you to place controls into groups, that are only visible when the form, or tab is active, both at design time and at run time.
JohnSQLer
|
|
|
|
|
The only way I have seen this work, is to go ahead and place all your panels on the form, one on top of the other. Then when you are not working on the panel that is currently on top, right-click on the panel, and select "send to back". Repeat this until the panel you want to work on is on top. I hope you don't have too many panels .
Roy.
|
|
|
|
|
Thank you for all the responses! I was able to figure out a solution to my problem and as a result I've got to admit I feel like such a VB.NET rookie.
I come from a C/C++ background where most of the UI and its functionality was done in code rather than from a form designer. As such I was unaware of the applications of "User Controls" in VB.NET and just how powerful they can be. What I did to solve my problem was simple: I created a new User Control for each "panel" I wanted displayed based upon the user selection from the Navigation panel. When a selection is made the "SelectedPanelChanged" event fires in which I have a series of test cases to test what selection the user made. Within each test case I have code along the lines of the following selection-specific example:
If (panMain.SelectedPanel.Text = "Search") Then
Dim xSearchControl As New TQTSearchControl
With Me.panContentsContainer.Controls
.Clear()
.Add(xSearchControl)
End With
End If
-- modified at 9:16 Thursday 25th May, 2006
|
|
|
|
|