|
hello,i have a database.mdb and i want all the fields of the database to be showed in the datagrid.i have an adodb connection and i do not want to use a flexgrid.how can i do this?
Private Sub Form_Load()
Dim sDate As Date
Dim eDate As Date
sDate = #6/15/2009 6:00:00 PM#
eDate = #6/15/2009 8:00:00 PM#
createDummyBase sDate, eDate, 20, "P1--01"
End Sub
all the code is in the createDummyBase
the connection,the recordsets and the database are in the createDummyBase
the datagrid is in the form load
Public Sub createDummyBase(ByVal sDate As Date, ByVal eDate As Date, ByVal period As Integer, ByVal nodeId As String)
Dim cn As adodb.Connection 'opc
Dim rs As adodb.Recordset
Dim sqlstr As String
Dim dbFilename As String
Dim orig_path, new_path As String
Dim RunDate As Date
Dim delDate As Date
Dim DataGrid As DataGrid
Dim rs1 As adodb.Recordset
dbFilename = "Report_" & Format(Now, "MM_YY") & ".mdb"
If Dir(App.Path & "\data\Report_" & Format(Now, "MM_YY") & ".mdb") <> "" Then
Else
orig_path = App.Path & "\data\Report_mm_yy.mdb"
new_path = App.Path & "\data\Report_" & Format(Now, "MM_YY") & ".mdb"
FileCopy orig_path, new_path
End If
Set cn = New adodb.Connection
cn.ConnectionString = BuildConnectionString(dbFilename)
Set rs = New adodb.Recordset
cn.Open
rs.LockType = adLockOptimistic
Set rs.ActiveConnection = cn
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open "Report", cn
RunDate = sDate
Do
rs.AddNew
rs!RecDate = RunDate
rs!nodeId = nodeId
rs!BatteryVoltage = findLastValue(RunDate, "BatteryVoltage", nodeId)
rs!i1 = findLastValue(RunDate, "I1", nodeId)
rs!i2 = findLastValue(RunDate, "I2", nodeId)
rs!I3 = findLastValue(RunDate, "I3", nodeId)
rs!MotorRun = findLastValue(RunDate, "MotorRun", nodeId)
rs!PowerFactor = findLastValue(RunDate, "PowerFactor", nodeId)
rs!WaterLevelOK = findLastValue(RunDate, "WaterLevelOK", nodeId)
RunDate = RunDate + TimeSerial(0, period, 0)
Loop Until RunDate > eDate + TimeSerial(0, 0, 1)
rs.Update
cn.Close
End Sub
the report is the table of the database which has been created.
the fields of the report we want to show in the datagrid
|
|
|
|
|
Why are you still using VB6 ? If I was stuck with maintaining a VB6 project, I'd probably use COM to add to it using C# or C++.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
hi,
expert i have create one simple application.
i selected one groupbox control in form and i want to change its appeance in diffrent from.
my groupbox apprerance is default just like square etc.
but want a groupbox Appearance is rectangle,Ellipse.
i hope u uderstand my querry.
Thanks.
|
|
|
|
|
The GroupBox control doesn't support this "out of the box". You'll have to create your own control to do this, or find a third party control. I don't know of any off the top of my head. But, if you Google for ".NET container controls" and do a little research, you might find something that fits your needs.
|
|
|
|
|
I am trying to add items entered into a textbox into a listbox after a user clicks a button.
But the only thing i want to do is format the way the list displays the input entered in the text box, so for example
a user enters into a text box: 12 23 3 48 10
each seperated by a space i want the listbox to display the data like this:
12
23
3
48
10
but I dont know how to format the listbox to display this way, please help thanks
|
|
|
|
|
You want to split the string using the split method to get the numbers as seperate strings and enter them seperately.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have writen a PSSnapin in Visual Basic but can find no information on the
following points:
1. How can the variables VerbosePreference and DebugPreference be changed during runtime?
2. How can the settings from PSCmdlet.vb be accessed from the console? (Using Get-PsSnapin MyDll only returns Name,Description & PSVersion).
3. How can one Exit the cmdlet at any point (without throwing an exception)?
4. What needs to be done to make Get-Help Get-MyCmdlet to work?
5. How can I access the equivalant of PowerShell MyInvocation.MyCommand during runtime, ie the commandline the user entered?
Any advice please?
|
|
|
|
|
1. Depending on what you mean by "during runtime", either through command parameters -verbose and -debug, by setting the $VerbosePreference or $DebugPreference, or by using the SessionState.PSVariable.Get/Set on the PSCmdlet.
2. Not sure what you are looking for here
3. You can use ThrowTerminatingError
4. Put an XML file with the name <libraryname>.dll-Help.xml with the appropriate schema in the same folder. You can get a program to help create these files here
5. You can get this from the aptly named MyInvocation property. This will only be available from a PSCmdlet.
|
|
|
|
|
Thank you, Sir. I have found a reference for making the required helpfile, .dll-Help.xml, so that one is fixed.By "During Runtime" I mean once the cmdlet is invoked by the user.
SessionState.PSVariable.Get/Set is a new one so I will investigate that; and likewise the MyInvocation property. I think I just retrieved "Powershell" from "My.Application.Info.CommandLine", which was not what I wanted.
I am still trying to set the -Verbose switch within a (Visual Basic) PS Cmdlet and can not get it to work:
Imports System.Management.Automation.PSCmdlet
Imports System.Management.Automation.SwitchParameter
Imports System.Management.Automation.Internal.CommonParameters
Dim setting As System.Management.Automation.Internal.CommonParameters
setting.Verbose = True 'Verbose is a SwitchParameter so should be settable.
(ERROR):variable 'setting' is used before it has been assigned a value...
modified on Friday, November 6, 2009 11:18 PM
|
|
|
|
|
Hi Friends,
I am trying to create dynamic Excel sheet with some kind of Pivot graphs in excel.Its working fine in mylocal system.But when i deployed in the server machine.Its saying Cannot create ActiveX component.
I tried with oexcel = New Excel.Application()
oexcel = CreateObject("Excel.Application")
Its working fine in local but not in server.
Please suggest me if any solution for this .
Regards
Ravi
|
|
|
|
|
Do you have the same version of Office installed on the server?
|
|
|
|
|
Also you should check the Interop assembly and making sure it is either included with the project (My Project -> References -> Copy Local = True) or installed into GAC on the server.
Daniel Rolfe
-------------
Lead Software Developer
VB 2005 ASP ADO - .NET2
|
|
|
|
|
Why does the appearance of my program differ between the different computers that I install it on?
Thanks
|
|
|
|
|
|
There are many possible causes. For someone to give an answer that is likely to be correct it would help if you are able to say in what ways it is different.
For example are the colours used different? Are the fonts different? Are the forms a different size?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I'm gonna bet my $.02 on a different set of common controls. A cool button on one PC, an old fashioned-button on the other.
I are Troll
|
|
|
|
|
Yea the Form size is different, one button was completely blacked out on the form until i changed the theme to xp, is there a way to make the program just adapt to whatever theme the computer is using?
Thanks
|
|
|
|
|
RyJaBy wrote: Yea the Form size is different,
screen Resolution would do that.
|
|
|
|
|
I haven't tried myself, but you might be able to solve it by adding a Manifesto[^]. The blog entry is for WPF, but I expect WinForms to have the same requirements.
Try this CodeProject article[^] on Visual Styles
I are Troll
modified on Friday, October 23, 2009 2:53 PM
|
|
|
|
|
Hi When i try to install my program on a computer that is 64 bit, it does not install. Does anyone know why this is, or how to overcome it?
Thanks
|
|
|
|
|
That would depend on what the error message is. You might want to check in the machines eventlog.
|
|
|
|
|
Hi Guys,
Does any one know how to set the document name of a crystal report that appears on the printer job list.
thanks
|
|
|
|
|
Hi to every body,
I'm a beginner and maybe I'm trying doing something too hard for me, so I try to ask you.
I have an application that prepare an email, without send it because the user has to add some other information to the body mail.
Until here I have no problem:
Dim oApp As New Microsoft.Office.Interop.Outlook.Application
Dim oMsg As Outlook._MailItem
Dim tBody As String, tSubject As String
oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
tSubject = "Claim management reference "
tBody = "Your Claim, referenced "
.....
oMsg.Subject = tSubject
oMsg.Body = tBody
oMsg.Display()
Now I have to understand if:
User press SEND (in this case I also have to looking for the sent mail an copy it to a Windows Folder)
User press CANCEL (in this case nothing happen)
I read somtihing about Inspector and event handler, but I have no idea how to begin.
Coould you please help me?
Thank you and best regards
Leonardo
|
|
|
|
|
Leonardo:
To save a message to a specific folder you would use the following code:
oMsg.SaveAs("C:\FolderName\Message.msg")
To save a message to the Drafts folder of outlook:
oMsg.Save()
Hope this helps..
:::EDIT:::
Also, using the Intellisense and Object Explorer features of VStudio will answer a lot of your own questions.
Intellisense will show you all available and exposed methods, properties and functions for objects.
Object Explorer will give you a full rundown of the methods, properties and functions within a class.
Daniel Rolfe
-------------
Software Engineer
VB, ASP.NET, ASP, PHP, SQL Server 2005, SQL Server 2008
|
|
|
|
|
Thank you, but this isn't what was I looking for.
I'm able to save a message, but I must understand if the user press SEND or CANCEL the email.
I have to do so, because VB2005 open Outlook with a new mail with subjecy and body filled. But I need that the user can modify the body or the recipients.
Finally, if the user send the mail I need to save it, otherwise nothing happen.
Can somebody haelp me?
Regards
Leonardo
|
|
|
|