|
Hi,
I have file as shown in the link:
http://mickey.ccs.uky.edu/doubt/a.doc
I need to parse the file and get the various text information present in it. Also, I need to differentiate whether it came from process or data(see file.)
Any help to achieve this would be highly appreciated.
Are there any ways to access the content of an OLE object ?
Looking forward for replies.
Thanks
Ignatius
|
|
|
|
|
Does anyone know how to format a date to October 02, 2004 when the incoming data is 10/02/2004? (Using Basic Syntax not Crystal Syntax)
The following code works in vb.net but I can't figure out what the correct syntax would be in the formula editor.
Dim dteSDate As Date = csvDataRow.Item("SDATE")
Dim strFormatSDate As String = Format(dteSDate, "MMMM dd, yyyy")")
All help is greatly appreciated!
|
|
|
|
|
|
|
I'm wanting to covert from using access to mysql on a program that I'm writing for myself, but I can't seem to set up the connection to the database in Visual Basic. I know it's an online database ,but I'd like to have a way to use the same information for the web interface as well as the desktop interface. Although on the desktop side, I don't want to use ASP, PHP, etc. If anyone has figured out how to do this, I would appreciate any direction on how to go about doing this,
|
|
|
|
|
Try to check the connection string library[^] and some discussion from here.[^]
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Does anybody know anything about using a text file with a DataGrid?
I have a tab-delimited text file that I would like to load into a DataGrid and the only information that I can find talks about using a database.
What I would like to do is load all lines with no tabs into column 1, load all lines with one tab into column 2, load all lines with two tabs into column 3, etc. The number of tabs will vary so I would like to be able to create columns as needed (on the fly).
Example:
Data in column 1
(one Tab) Data in column 2
Data in column 1
(one Tab) Data in column 2
(two tabs) Data in column 3
Data in column 1
Thanks
Brad
|
|
|
|
|
You will need to specify weather you are using VB6 or .NET, the code willbe quiet different.
Thanks,
Daryl
|
|
|
|
|
Daryl Morgans wrote:
You will need to specify weather you are using VB6 or .NET
I'm running .NET.
Brad
|
|
|
|
|
What you will need to do is create a datatable to store the file in. The following should get you started.
Dim dt As New DataTable("MyTable")
Dim dc As New DataColumn("Column1")
Dim rw As DataRow
rw = dt.NewRow()
rw("Column1") = SomeValue
dt.Rows.Add(rw)
MyDataGrid.Datasource = dt
|
|
|
|
|
Cool!
That looks like it will get me going in the right direction.
Thanks Daryl
|
|
|
|
|
Try This Code:
While nPosition <= UBound(g_workList)
GetFileList(g_workList(nPosition))
nPosition = nPosition + 1 'INCREMENT nPosition HERE!
End While
|
|
|
|
|
Hey,
That worked for the first iteration through GetFileList but then when an increment is made, this needs to be passed back in to the GetFileList function but it instead exits the while loop as it becomes greater than the UBound of the array which is a problem at this time during execution.
Thanks for your help
Chris
|
|
|
|
|
I guess this will solve your problem:
While nPosition < UBound(g_workList) 'Changed the condition
GetFileList(g_workList(nPosition))
nPosition = nPosition + 1
End While
|
|
|
|
|
Without the <= the while loop is never entered because at first nposition has not been incremented and is '0' and the Ubound value of the array is also '0'.
Thanks for your help
Chris
|
|
|
|
|
Problem solved.
Thanks for the help
Chris
|
|
|
|
|
Hi All I wanted to use TAPI in VB.NET.. where a user will dial a number the system will check the users number as an authenticating process and reply back with a message that is stored for that particular user.
Agnelo Noronha
|
|
|
|
|
How can I definite an account is admin's?
I tried to get a registered key (the path of Winword.exe) by VB6 (used API). It was success with my computer (admin account), but failed with others ?!!
Help me, please!
GF bos
|
|
|
|
|
Hey I'm making a breakout game and my problem is that I cant get the ball to bounce off the paddle.
heres the code:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim intHorizontalMomentum As Integer
Dim intVerticalMomentum As Integer
Dim intPaddleSpeed As Integer
Dim intOrigPaddleLocation As Integer
Dim dblDeflectAngle As Double
Dim intDifficulty As Integer
Dim varDeflectAngle As Double
Const constOrigBallLocX = 5000
Const constOrigBallLocY = 3000
#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 picPaddle As System.Windows.Forms.PictureBox
Friend WithEvents picBall As System.Windows.Forms.PictureBox
Friend WithEvents picWallTop As System.Windows.Forms.PictureBox
Friend WithEvents picWallLeft As System.Windows.Forms.PictureBox
Friend WithEvents picWallRight As System.Windows.Forms.PictureBox
Friend WithEvents picBrick As System.Windows.Forms.PictureBox
Friend WithEvents tmr1 As System.Windows.Forms.Timer
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.picPaddle = New System.Windows.Forms.PictureBox
Me.picBall = New System.Windows.Forms.PictureBox
Me.picWallTop = New System.Windows.Forms.PictureBox
Me.picWallLeft = New System.Windows.Forms.PictureBox
Me.picWallRight = New System.Windows.Forms.PictureBox
Me.picBrick = New System.Windows.Forms.PictureBox
Me.tmr1 = New System.Windows.Forms.Timer(Me.components)
Me.SuspendLayout()
'
'picPaddle
'
Me.picPaddle.BackColor = System.Drawing.SystemColors.Highlight
Me.picPaddle.Image = CType(resources.GetObject("picPaddle.Image"), System.Drawing.Image)
Me.picPaddle.Location = New System.Drawing.Point(288, 424)
Me.picPaddle.Name = "picPaddle"
Me.picPaddle.Size = New System.Drawing.Size(100, 16)
Me.picPaddle.TabIndex = 0
Me.picPaddle.TabStop = False
'
'picBall
'
Me.picBall.Image = CType(resources.GetObject("picBall.Image"), System.Drawing.Image)
Me.picBall.Location = New System.Drawing.Point(40, 192)
Me.picBall.Name = "picBall"
Me.picBall.Size = New System.Drawing.Size(16, 16)
Me.picBall.TabIndex = 1
Me.picBall.TabStop = False
'
'picWallTop
'
Me.picWallTop.Image = CType(resources.GetObject("picWallTop.Image"), System.Drawing.Image)
Me.picWallTop.Location = New System.Drawing.Point(0, 0)
Me.picWallTop.Name = "picWallTop"
Me.picWallTop.Size = New System.Drawing.Size(720, 16)
Me.picWallTop.TabIndex = 2
Me.picWallTop.TabStop = False
'
'picWallLeft
'
Me.picWallLeft.Image = CType(resources.GetObject("picWallLeft.Image"), System.Drawing.Image)
Me.picWallLeft.Location = New System.Drawing.Point(0, 0)
Me.picWallLeft.Name = "picWallLeft"
Me.picWallLeft.Size = New System.Drawing.Size(16, 456)
Me.picWallLeft.TabIndex = 3
Me.picWallLeft.TabStop = False
'
'picWallRight
'
Me.picWallRight.Image = CType(resources.GetObject("picWallRight.Image"), System.Drawing.Image)
Me.picWallRight.Location = New System.Drawing.Point(680, -1)
Me.picWallRight.Name = "picWallRight"
Me.picWallRight.Size = New System.Drawing.Size(16, 456)
Me.picWallRight.TabIndex = 4
Me.picWallRight.TabStop = False
'
'picBrick
'
Me.picBrick.Image = CType(resources.GetObject("picBrick.Image"), System.Drawing.Image)
Me.picBrick.Location = New System.Drawing.Point(296, 72)
Me.picBrick.Name = "picBrick"
Me.picBrick.Size = New System.Drawing.Size(100, 24)
Me.picBrick.TabIndex = 5
Me.picBrick.TabStop = False
'
'tmr1
'
Me.tmr1.Enabled = True
Me.tmr1.Interval = 1
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.SystemColors.ControlText
Me.ClientSize = New System.Drawing.Size(696, 454)
Me.Controls.Add(Me.picBrick)
Me.Controls.Add(Me.picWallRight)
Me.Controls.Add(Me.picWallLeft)
Me.Controls.Add(Me.picWallTop)
Me.Controls.Add(Me.picBall)
Me.Controls.Add(Me.picPaddle)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
intDifficulty = 10
intHorizontalMomentum = -intDifficulty
intVerticalMomentum = 10
End Sub
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
Select Case keyData
Case Keys.Left
intPaddleSpeed = intDifficulty
Case Keys.Right
intPaddleSpeed = -intDifficulty
Case Else
Return MyBase.ProcessCmdKey(msg, keyData)
End Select
Return True
End Function
Private Sub tmr1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmr1.Tick
picPaddle.Left = picPaddle.Left - intPaddleSpeed
picBall.Top = picBall.Top + intVerticalMomentum
picBall.Left = picBall.Left + intHorizontalMomentum
'paddle
If picBall.Top - picBall.Height <= picPaddle.Top Then
picBall.Top = picPaddle.Top + picPaddle.Height
intVerticalMomentum = -intVerticalMomentum
End If
'left wall
If picBall.Left <= picWallLeft.Left + picWallLeft.Width Then
picBall.Left = picWallLeft.Left + picWallLeft.Width
intHorizontalMomentum = -intHorizontalMomentum
End If
'right wall
If picBall.Left + picBall.Width >= picWallRight.Left Then
picBall.Left = picWallRight.Left - picBall.Width
intHorizontalMomentum = -intHorizontalMomentum
End If
'top wall
If picBall.Top <= picWallTop.Top - picWallTop.Height Then
picBall.Top = picWallTop.Top - picWallTop.Height
intVerticalMomentum = -intVerticalMomentum
End If
'paddle/wall
If picPaddle.Left <= picWallLeft.Left + picWallLeft.Width Then
picPaddle.Left = picWallLeft.Left + picWallLeft.Width
intPaddleSpeed = 0
End If
If picPaddle.Left + picPaddle.Width >= picWallRight.Left Then
picPaddle.Left = picWallRight.Left - picPaddle.Width
intPaddleSpeed = 0
End If
End Sub
Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
intPaddleSpeed = 0
End Sub
End Class
the problem is after the 'paddle
plz help thanks
|
|
|
|
|
Reading your code is really a hard work being mentioned this way!
Try just sending the parts you have writen or the parts causing the error and ALSO the error description
|
|
|
|
|
When I click on the save button I get a error. Here is the code
Private Sub SaveRecord()
Dim pdsSaveRow As DataSet
Me.BindingContext.(Me.DsCustomerIndividual1, "Customers").EndCurrentEdit()
pdsSaveRow = DsCustomerIndividual1.GetChanges(DataRowState.Modified)
odaCustomerIndividual.Update(pdsSaveRow)
Me.DsCustomerIndividual1.Customers.AcceptChanges()
End SubPrivate Sub SaveRecord()
Dim pdsSaveRow As DataSet
Me.BindingContext(Me.DsCustomerIndividual1, "Customers").EndCurrentEdit()
pdsSaveRow = DsCustomerIndividual1.GetChanges(DataRowState.Modified)
odaCustomerIndividual.Update(pdsSaveRow)
Me.DsCustomerIndividual1.Customers.AcceptChanges()
End Sub
|
|
|
|
|
What's the error you are getting?
|
|
|
|
|
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidOperationException: Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
at How_To_1._1.Form1.SaveRecord() in C:\Documents and Settings\Harrison\My Documents\Visual Studio Projects\How-To 1.1\Form1.vb:line 504
at How_To_1._1.Form1.txtSave_Click(Object sender, EventArgs e) in C:\Documents and Settings\Harrison\My Documents\Visual Studio Projects\How-To 1.1\Form1.vb:line 514
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
How-To 1.1
Assembly Version: 1.0.1780.42193
Win32 Version: 1.0.1780.42193
CodeBase: file:///C:/Documents%20and%20Settings/Harrison/My%20Documents/Visual%20Studio%20Projects/How-To%201.1/bin/How-To%201.1.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
Accessibility
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3052.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
|
|
|
|
|
hi folks
i hope some experienced VB programmer will be able to help me here. I am using a free video capture control that i got from the net on a form in my application .its works fine saves some frames and emails them .
BUT is it possible to capture video in background when the application window is minimized .??
its not possible for me so far caz when i minimize the window i think the control loses focus or stops refreshing and the video display is not updated.
My requirement is to make this application as service or background application so that video capture happens in background when the application window is minimzed so that user can do other stuff..
any ideas suggestions .....??
thanx in advance
|
|
|
|
|
Hi,
I am having problems with using the DrawToDC of the
MSHTML.iHTMLElementRender in a VB.net application. For some reason I am
getting a "catastrophic error". I am basing the code on c# examples, and I cant figure out what I am doing wrong. From the C# posts it seems that
the drawtodc has a bug and you need to redifine it, so i followed their
advice and specified an interface as below but without any luck:
iHTMLElementRender Interface Code
Imports System
Imports System.Drawing
Imports System.Runtime.InteropServices
Imports mshtml
<ComVisible(True), ComImport(),
Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
Interface IHTMLElementRender
Sub DrawToDC(<[In]()> ByVal hDC As IntPtr)
Sub SetDocumentPrinter(<[In](), MarshalAs(UnmanagedType.BStr)> ByVal
bstrPrinterName As String, <[In]()> ByVal hDC As IntPtr)
End Interface 'IHTMLElementRender
On the main form of the application I am have the folowing code when a button is clicked:
Dim objMSHTML As HTMLDocument
Dim objDocument As IHTMLDocument2
Dim ips As IPersistStreamInit
objMSHTML = New HTMLDocument()
ips = DirectCast(objMSHTML, IPersistStreamInit)
ips.InitNew()
objDocument =
objMSHTML.createDocumentFromUrl("http://www.google.com", String.Empty)
Do Until objDocument.readyState = "complete"
Application.DoEvents()
Loop
MsgBox(objDocument.body.outerHTML)
Dim bodyElement As IHTMLElement
Dim render As IHTMLElementRender
If objDocument.body.outerHTML <> Nothing Then
bodyElement = objDocument.body
render = bodyElement
Dim img As New Bitmap(600, 400)
Dim g As Graphics = Graphics.FromImage(img)
Dim memDC As IntPtr
memDC = g.GetHdc()
Try
render.DrawToDC(memDC)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End If
It seems like I am getting the HTML document just fine, is just that when I
try to use DrawToDC to get the application to print/send to the DC i Created
in memory, it causes the error.
From the dotnet newsgroups I was told I am not hosting MSHTMl fully and that might be the cause . I was told that I should use either the internetexplorer/webbrowser controls or the MSHTMl fully. I cannot find any source on the web on how to do this in vb.net I tried the following but this also failed.
Dim browser As New SHDocVw.InternetExplorer()
browser.Navigate("http://www.google.com")
Do Until browser.ReadyState = 4
Application.DoEvents()
Loop
Dim objDocument As IHTMLDocument2 = browser.Document
MsgBox(objDocument.body.outerHTML)
Dim bodyElement As IHTMLElement = objDocument.body
Dim render As IHTMLElementRender = bodyElement
Dim img As New Bitmap(600, 400)
Dim g As Graphics = Graphics.FromImage(img)
Dim memDC As IntPtr
memDC = g.GetHdc()
Try
render.DrawToDC(memDC)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Here are the links to where I got the C# examples:
http://groups.google.com/groups?hl=en&lr=&threadm=a299f931.0406011058.43b92799%40posting.google.com&rnum=5&prev=/groups%3Fnum%3D100%26hl%3Den%26lr%3D%26q%3DDrawToDC%2B%2Bfailure
http://blogs.msdn.com/rfarber/archive/2004/10/12/240943.aspx
The article from this site with a C++ example:
http://www.codeproject.com/internet/htmlimagecapture.asp?msg=783713
Any ideas on what exactly I am doing wrong? Is it something to do with how I am hosting mshtml, or is it something with the iHTMLElementRender interface?
thanks
|
|
|
|