Jump to content
Xtreme .Net Talk

fillibar

Members
  • Posts

    8
  • Joined

  • Last visited

fillibar's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks! Have events now. You would think there could be an easier way to do this, but this will fit the bill.
  2. That will not work. While it will generate the buttons, and give them the correct text, they cannot have WithEvents. Thus they cannot run any code if someone clicks on them, because you cannot make an event handler for them without the WithEvents clause.
  3. 'In VB6 I would have had sets like: Begin VB.CommandButton btnPlayerInfo Caption = "Player2 Info" BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Index = 1 Left = 120 TabIndex = 10 Top = 840 Width = 3255 End 'With that I could call a "for" loop like so: (overly simplified) For X = 0 to 7 frmMain.btnPlayerInfo(X).Text = Player(X).Name & "'s Info" Next X I am looking for an equivalent in VB.Net rather then having to say: ...btnPlayerInfo1.Text = Player(0).Name & "'s Info" ...btnPlayerInfo2.Text = Player(1).Name & "'s Info" ...btnPlayerInfo3.Text = Player(3).Name & "'s Info" and so on for every single value I need to set in the forms...
  4. I checked the forum, and ran across someone that had 500 textboxes, for which an array can work. My problem is that I have between 8 and 22 elements on different forms which require the WithEvents setting. These are primarily checkboxes that enable or disable other, conflicting checkboxes, and buttons that open option windows. In VB6 I simply made them all indexed, so could create them as part of loops as needed. VB.Net states that a WithEvents object cannot be part of an array. I would REALLY want to avoid making each button and checkbox separate, because the code would be highly redundant, and VERY annoying then. Is there any way to make the equivalent of indexes(arrays) while retaining WithEvents? I tried making a custom class, but it still got the same error. And yes, I did check the FAQ, and I am not sure that will entirely suit my needs.
  5. It makes sense to have the function not contain the open and close... But I receive this error when it reaches the ExecuteNonQuery: An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll Code looks like this (edited for fields and data/datasource): Imports System.Data.OleDb Module modADO Public DocsDBConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataSource & ";Persist Security Info=False") Public Sub OpenDB() DocsDBConnection.Open() End Sub Public Sub CloseDB() DocsDBConnection.Close() End Sub Public Function TestDB() As Boolean Dim CurrentDate As Date = Now Dim DocsDBCommand As New OleDbCommand("INSERT INTO DocIndexTable (field1,field2,field3) VALUES(1,'Text'," & CurrentDate & ")", DocsDBConnection) DocsDBCommand.ExecuteNonQuery() TestDB = True End Function End Module
  6. How would I represent the AddNew with all the fields of data as myExecuteQuery? I do have to admit, while my program creates a nicely populated database now, it takes over 10 times as long to run... Program Description: It creates on the order of 5K (at this time, will increase) files, and has to record all of them in the DB.
  7. Thanks! Thanks for that piece, you just solved a problem I've been banging my head on for a LONG time...
  8. I have Zero database knowledge I think, but in VB6 I was able to write regarding a huge number of files I need to create into a database for tracking purposes. I connected to the database like: Public Sub dbConnect(DataSource As String) Set dbConnection = New ADODB.Connection dbConnection.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DataSource & ";Persist Security Info=False") Set dbRecord = New ADODB.Recordset dbRecord.CursorType = adOpenKeyset dbRecord.LockType = adLockOptimistic dbRecord.Open "docIndexTable", dbConnection, , , adCmdTable End Sub And added my records like: dbRecord.AddNew dbRecord!DocumentNumber = dbIndex dbRecord!DocumentTitle = "PlaceHolder" dbRecord!DocumentRelativePath = PathName dbRecord!DocumentFilename = FileName dbRecord!DocumentNeeded = True dbRecord!SearchKeywords = Null dbRecord!RelatedDocumentNumbers = Null dbRecord!DateDocumentLastEdited = Date dbRecord.Update I am looking to do the same thing with VB.Net, but so far it has eluded me, and all the examples I can find focus on USING the database. I just need to write to it, never read the data (except by opening Access). Any help would be appreciated.
×
×
  • Create New...