|
You didn't read the article. The problem you're concentrating on handling the mouse move in the LineControl's events. DON'T! The mouse is actually moving in the parent container of the LineControl. This is why your code doesn't work.
|
|
|
|
|
Hi Dave ,
Thanks for reply & Thanks for the Link ,Presently i am using ur code in my application for changing the line startpoint and endpoint and dragging the line also.
Can u suggest me in a sample program that how can i move a LineShape control freely around the form with cursor without slipping .
This is happening in a sample new form.
This is the code i used & its slipping from cursor .
Dim fdragging As Boolean = False
Dim StartX, startY As Integer
Private Sub LineShape1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LineShape1.MouseDown
fdragging = True
StartX = e.X
startY = e.Y
End Sub
Private Sub LineShape1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LineShape1.MouseMove
Cursor.Current = Cursors.SizeAll
If fdragging Then
LineShape1.StartPoint = New Point(LineShape1.StartPoint.X + e.X - StartX, LineShape1.StartPoint.Y + e.Y - startY)
LineShape1.EndPoint = New Point(LineShape1.EndPoint.X + e.X - StartX, LineShape1.EndPoint.Y + e.Y - startY)
End If
End Sub
Private Sub LineShape1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ShapeContainer1.MouseUp
fdragging = False
StartX = 0
startY = 0
End Sub
its important for me . plz can u suggest any work around ?
Regards,For1206
modified on Tuesday, February 23, 2010 1:57 AM
|
|
|
|
|
Read the article. I don't have time to write an entire sample app for you.
|
|
|
|
|
Hi Dave,
Thanks 4 reply . I already implemented your code in my application .Its made a nice job for me.
Thank you very much .
Regards,For1206
|
|
|
|
|
Hey All
I am having difficulty running a specific SQL statement in VB and was wondering if there is a way around it.
The problem I am having involves using "LIKE":
e.g. SELECT * FROM Table WHRE Field1 LIKE 'start*' (where start is the start of any text taken in as a parameter).
When I program an SQL statement like in VB, it won't yield the results I am looking for. I tested the code within SQL Server and MS Access Database and it works fine, but when I try again in the VB program, it yields no values.
The code does, however, work for "WHERE Field1 LIKE 'start'". So that means it has a problem with accepting the hash as part of the SQL query. I even tried using the VB character set within the SQL, but that too doesn't work.
Is there a way around this, or does VB not make use of the hash for an SQL statement?
Seems very weird to me.
Thanks for the help in advance!
|
|
|
|
|
Hi Evan
When using LIKE in SQL you should use the % character to indicate a wildcard character like this, SELECT * FROM Table WHERE Field1 LIKE 'Start%'. This works with Access databases as well as with MySql Databases, so should work with SQL Server.
Hope this helps
|
|
|
|
|
Hi
Thanks for the quick response...the '%' works perfectly.
Seems embarrassing for me to get stuck on such simple stuff when programming complicated systems sometimes.
Is there any reason why when using '*' works within each database but not when runnnig it through VB (or any other language) instead of '%'?
|
|
|
|
|
Because this is SQL syntax.
|
|
|
|
|
EvanSaunders wrote: SELECT * FROM Table WHRE Field1 LIKE 'start*'
Use % instead of *
SELECT * FROM Table WHRE Field1 LIKE 'start%'
|
|
|
|
|
|
VB does NOT use nor interpret any part of an SQL statement. All that state is to VB is just another String.
|
|
|
|
|
How to autodetect a CD/DVD in my CD/DVD Room?
|
|
|
|
|
Hello Cpianism ,
Every Operating System Have services for detection of Hardware the second form you can says they are drivers.
When you insert any device like (USB,CD,DVD) then the driver retrives notificaton.
Best Regard
AnubhavaIf you can think then I Can.
|
|
|
|
|
I need it by code. I need to write a program that copy the CD content once it detect it in the CD room. If you need anymore questions please do ask me.
|
|
|
|
|
|
Thanks, I will take a look at it now
|
|
|
|
|
Hi,
I use this code for generating the data from Grid to Excel
Dim fs As New FileStream("D:\Library.xls", FileMode.Create)
Dim reportDataAdapter As IReportDataAdapter = New DataGridViewReportDataAdapter(datagrid)
Dim winFormsReportExporter As IReportExporter = New WinFormsReportExporter(reportDataAdapter)
Dim xlsFiledata As MemoryStream = winFormsReportExporter.ExportToXls
xlsFiledata.WriteTo(fs)
fs.Close()
xlsFiledata.Close()
But I get error message "An error occured during local report processing" near the line 4. Can any one help in solving the problem.
Regards,
JohnRegards,
John.L.Ponratnam
modified on Monday, February 22, 2010 2:07 AM
|
|
|
|
|
Dim LoExcel As Microsoft.Office.Interop.Excel._Application,Dtb102 As New DataTable,MyExlFl as String
LoExcel = New Microsoft.Office.Interop.Excel.Application
Dim oSheet As Microsoft.Office.Interop.Excel.Worksheet
LoExcel = CreateObject("Excel.Application")
LoExcel.Workbooks.Add()
oBook = LoExcel.ActiveWorkbook
oSheet = LoExcel.ActiveWorkbook.ActiveSheet
LoExcel.Cells.Select()
LoExcel.ReferenceStyle = Microsoft.Office.Interop.Excel.XlReferenceStyle.xlR1C1
LoExcel.DisplayAlerts = False
oSheet.Cells(1, 1).value = "Project : " + Trim(Dtb102.Rows(0).Item("proj_city").ToString)
blah.....blah....blah...
MyExlFl = Drctry101 + "\Comparision_To_MPR_" + TextBox1.Text + ".xls"
Try
oBook.SaveAs(MyExlFl)
Catch ex As Exception
System.IO.Directory.CreateDirectory(Drctry101)
oBook.SaveAs(MyExlFl)
End Try
LoExcel.WindowState = Microsoft.Office.Interop.Excel.XlWindowState.xlMaximized
'oBook.PrintPreview(True)
LoExcel.Visible = True
LoExcel.ActiveWorkbook.PrintPreview()
LoExcel.Quit()
|
|
|
|
|
Hello,
Is there a way where upon clicking a button, i can execute a code from a textfile, and if it find certain character (for example ':') in the textfile, it will pause the execution. And i can resume back the execution where it left by click the same button again?
Please help. Thanks.
|
|
|
|
|
Your question doesn't make sense. Are you saying that you want to run user-written code out of a text file? What are you ultimately trying to do with this?
|
|
|
|
|
Hi Dave,
Currently my program will import a textfile (like an script) and display it first on the GUI. This textfile has a list of smartcard commmands. See example below. Right now, it will treat '/' as comment and do nothing, otherwise, it will execute those commands.
I have a problem where on certain line, say line 00aa000000, i need to get out from the code and do something on my GUI manually. And i can resume back the operation (maybe i can click the same button?) starting at the line after the 00aa000000.
example of imported text file:
//this is an example of smartcard command
0011000000
0022000000
0033000000
//get out from code after this line below
00aa000000
//need to resume starting from here
0044000000
0055000000
//end of command
I am really2 new in this VB programming but know this is possible. Maybe you could help me a little bit?
- xiah -
|
|
|
|
|
The proper way to do this would be to move the processing of the file to a background thread, freeing up the UI to handle button clicks and UI updates. Google "BackgroundWorker class" and you'll find plenty of examples. Though, threading is NOT a beginners subject.
|
|
|
|
|
I will start searching for more info. Thanks Dave!
|
|
|
|
|
Hi,
starting from Microsoft example I have wrote a very little clase to write into the eventlog.
Public Class frmEventWrite
Public Function WriteToEventLog(ByVal Entry As String, _
ByVal AppName As String, _
ByVal EventType As EventLogEntryType, _
ByVal LogName As String) As Boolean
' Create the source, if it does not already exist.
If Not EventLog.SourceExists(AppName) Then
EventLog.CreateEventSource(AppName, LogName)
End If
' Create an EventLog instance and assign its source.
Dim myLog As New EventLog()
myLog.Source = AppName
' Write an informational entry to the event log.
myLog.WriteEntry(Entry, EventType)
Try
Return True
Catch Ex As Exception
Return False
End Try
End Function
Everything works BUT, I can't change the EventID, can be possibile it?
I mean change for example the numerber inside the EventiID, to insert numbers like 1042, etc. and not always 0.
Thanks.
|
|
|
|
|
Guizzardi wrote: I mean change for example the numerber inside the EventiID, to insert numbers like 1042, etc. and not always 0.
Because the code you posted doesn't write an eventID. Use one of the other WriteEntry method overloads that takes an Int32 (Integer) and you can provide an EventId.
|
|
|
|