|
I have never used RegionData.Data, but I found some stuff via google[^]. And
here[^] is microsoft's documentation.
|
|
|
|
|
I was looking to try to use the Region class to do some boolean operations on polygons too, not so much for graphics, but for other purposes.
Anyway, I managed to decode the RegionData structure enough to find out that it does not seem to give the resultant set of points after the operation that we are looking for. Essentially, all it appears to contain is the starting region and a record of the operations you have performed. I'm sure there's something buried in GDI+ that actually applies the operations, but I don't think RegionData is it.
For me, it is back to the drawing board.
|
|
|
|
|
I have an Isometric grid that gets drawn to a bitmap bigger then the screen, then the section of it that has been scrolled to is drawn. How can I figure out where on the grid the user clicked? Should I create an invisible normal square grid over the isometric one? It wouldn't perfect but it might work. Please help
Have you tried the Krypton Toolkit? http://www.componentfactory.com/free-windows-forms-controls.php
|
|
|
|
|
I would have expected you to track the scroll position and the x/y coords of the mouse click to track where the user is in relation to the grid. I wonder if the scroll an absolute or is it diffetent for different resolution monitors?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thats basically what I'm doing but its an isometric grid (diamonds, not squares) so it isn't quite perfect.
Have you tried the Krypton Toolkit? http://www.componentfactory.com/free-windows-forms-controls.php
|
|
|
|
|
Hi I have Visual Studio 2008 installed and I am working on a Windows Form with a menu.
I have builded all the elements of menu File...View ..Edit and also added shortcuts.
Everything seems fine on Ddesign View but when I build -run project I can see only the menu without shortcuts.What's going on??
BR
|
|
|
|
|
If by shortcut, you mean the underlined letter in each menu item, hold down the <Alt> key.
Otherwise, the MenuItems have a ShowShortcutKeys property, set it to true
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 tried with ALT and the property ShowShortcutKeys is set to true but the result is the same.
BR
|
|
|
|
|
Did you put an "&" character in front of the character that you're using as the shortcut key??
|
|
|
|
|
I have an application in which i create a thread to run a certain process.
There is a api function call in the thread that tries to connect through TCP/IP to a device and get some data from it.If the device is disconnected then I get a socket exception.
I need to handle this exception however I found out during debugging that even though the exception was thrown,it went unhandled even though I put a try catch block.
However when i run it on the Main UI thread everything is fine.
After doing some searches on this issue I have understood that general exceptions cannot be handled in threads?Is this correct?
If so,is there a way to handle this socket exception?If any one has any idea about this or can direct me to any good articles on this...really appreciate it..
|
|
|
|
|
Hi,
I would guess you tried and did something to the GUI inside the catch block, violating the "only main/GUI thread should ever touch any Control" rule, which causes another exception and that one does no longer get caught by your try-catch since you are already in the catch block.
Experiment with Console.WriteLine() or some file operation to confirm my theory, then start using the Control.InvokeRequired/Control.Invoke pattern.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I didnt understand exactly what you mean..
This is how I am doing it the threading way.
Public Sub somfunction()
'''I make all the thread declarations (address of startthread)
Thread.start()
End Sub
Public Sub startthread
Try
''''APi function call to connect to device --this throws a socket exception when the device is not available but i cannot catch this exception.It throws the exception but it doesn't go to the catch block.
catch ex as exception
End try
End sub
But when I do it on the main thread (on the form)
Public sub somfunction
Try
''API function call----this socket exception is caught
Catch ex as exception
End try
End Sub
End Sub
|
|
|
|
|
The idea of a try-catch construct is you put some code in the try block AND some code in the catch block; an empty catch block is a deadly sin, it is worse than no try-catch at all: it swallows the exception and doesn't do anything with it. At least log it somewhere, say Console.WriteLine(ex.ToString()) so you will notice if and when it occurs.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Did you put the exception handler inside the method running on the thread or in the method that started the thread? In general, if an exception occurs on a background thread and that thread does not handle the exception, the thread dies and no notification is made to the main program.
Option A (do this)
Private Sub ThreadRunMethod()
Try
'your code here that throws an exception
Catch ex as Exception
'something that handles the exception, but
'does not modify the UI directly.
End Try
End Sub
Private Sub OtherMethod()
Dim myThread as New Thread(AddressOf ThreadRunMethod)
myThread.Start()
End Sub
Option B (don't do this, the start method will return right away)
Private Sub ThreadRunMethod()
'your code here that throws an exception
End Sub
Private Sub OtherMethod()
Dim myThread as New Thread(AddressOf ThreadRunMethod)
Try
myThread.Start()
Catch ex As Exception
'handle exception from thread method
End Try
End Sub
|
|
|
|
|
Thanks guys I will try your way and see what happens.
Sorry Luc but I had forgot to mention in the example,I have put a error log entry that writes to a text file in the catch block,but the thing is when the exception is thrown it never goes to the catch block.The thread then just dies.I never know that the socket exception occurred.
I can only seem to catch the Thread Abort Exception in the thread.I am not sure but I had read this article somewhere on the net that only Thread Abort Exception can be handled in background threads.Thought you guys could give me more info on this.
|
|
|
|
|
Hello everybody,
maybe here's someone around who can help end the vicious circle I'm stuck in...
I'm writing a helper class for Outlook in VB2008 Express. The class checks if an Outlook MailItem is an inquiry (following a standardized pattern) or not, and exposes a few methods and properties to be used in VBA. Everything worked fine as long as I didn't try to structure the exposed information, i.e. as long as I held all the fields derived from a mail in the main class's properties.
Then I tried to structure the fields into different classes like "ProductInfo", "CustomerInfo" etc with their relevant methods/properties, additionally placing each of these sister classes into a property of the main class. As a result I could (after regasm, setting the reference in Outlook etc.) see all the classes and their methods/properties in the object catalog of Outlook VBA - and when writing the VBA code, everything seems to be ok and even IntelliSense works, including the hierarchy. So when I type 'Inquiry' and a dot, the nethods and properties of the main class show, typing 'Inquiry.Client." the properties of the client-class show.
And then? At runtime, the sister classes throw an error (object variable not set)...
'(VBA Code)
Public Sub Examine()
Dim Item As MailItem
For Each Item In Application.ActiveExplorer.Selection
Dim Inq As MSInquiryNET.Inquiry
Set Inq = New MSInquiryNET.Inquiry
'Kontrolle ob Kunden-Daten in der Auswahl enthalten sind
Set Inq.Item = Item
Inq.CheckItem Item <--- WORKS (method of main class)
MsgBox Inq.Medium <--- WORKS (property of main class)
MsgBox Inq.Client.FirstName & " " & Inq.Client.FamilyName <---- ERROR
Set Inq = Nothing
Next
End Sub Can anyone tell me what I would have to change in order to avoid that error?
Here's my .NET code (abbreviated):
<Runtime.InteropServices.ComVisible(True)> _
<Microsoft.VisualBasic.ComClass()> _
Public Class Inquiry
Public Function CheckItem(ByVal oMsg As Outlook.MailItem) As Boolean
Me.Medium = GetMedia(oMsg)
Me.Item = oMsg
Try
Select Case Me.Medium
Case "PaperAds"
CollectScoutDataHTML()
Case Else
MessageBox.Show(String.Format("Die Abfrage für '{0}' ist noch nicht automatisiert möglich.", Me.Medium), "Abbruch", MessageBoxButtons.OK)
Return False
End Select
Return True
Catch ex As System.Exception
MsgBox(String.Format("Fehler in der Routine '{0}'", "CheckItem"))
End Try
End Function
' main class' properties
Private _Client As Client
Public Property Client() As Client
Get
Return _Client
End Get
Set(ByVal value As Client)
_Client = value
End Set
End Property
Private _Item As MailItem
Public Property Item() As MailItem
Get
Return _Item
End Get
Set(ByVal obj As MailItem)
_Item = obj
End Set
End Property
End class
<Runtime.InteropServices.ComVisible(True)> _
<Microsoft.VisualBasic.ComClass()> _
Public Class Client
Private _FirstName As String
Public Property FirstName() As String
Get
Return _FirstName
End Get
Set(ByVal value As String)
_FirstName = value
End Set
End Property
Private _FamilyName As String
Public Property FamilyName() As String
Get
Return _FamilyName
End Get
Set(ByVal value As String)
_FamilyName = value
End Set
End Property
End class I assume that I have to set an object for the sister classes somewhere in the .NET code, but by now my attempts failed. Where and how would I declare and expose such an object properly?
Thank you for advice,
Michael
|
|
|
|
|
Too bad that I can't vote for myself coz' I solved the issue by simply adding a new-constructor to the main class, instantiating the sister classes:
Public Sub New()
Me.Client = New Client
End Sub
Of course I'd still be interested in constructive criticism regarding the rest of my approach.
Thank you
Michael
|
|
|
|
|
Hi,
I have created an application using VB6. I want to limit my exe to get install only via my installer. When i install my application an exe is placed in system, if some one copy that exe and paste it in other computer, he can also use the same exe to run application and use. So if there is any way so that i can limit my installation to that particular PC where i have installed it using Installer.
Regards,
Kaushal Arora
modified on Wednesday, July 15, 2009 9:26 AM
|
|
|
|
|
1st Help is not very descriptive of your problem, as everyone posting here is in need of some help.
2nd VB6? Why? It's obsolete by at least 7 years.
3rd You perhaps should look at a system of registration for example, taking some data from the PC and generate an ID that can be used to generate an activation key.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
I am writing an application that integrates with an accounting package(running on SQL). I need to add more tables to the existing database that only my application will use. I've created code to add the tables and it works fine. My question is where do I place this code in my program.
I currently run it when the application starts - it tries to create the table, if it doesn't exist it will create it, if it does exist I get an error and the code just continues without creating the table.
The problem with this approach is that every time the application runs it tries to create the table which I think is unnecessary, because after the first time the table would already be there.
I now want to add the code to create the table at the point where I need to use the table, i.e. when I try to read from the table and it is not there, I get an error and only then will the table be created.
Is this the right approach? And if so, how do I distinguish between different errors (if the problem is with the connection I do not want to create a table, but maybe display a message or something).
I hope this makes sense to someone.
|
|
|
|
|
It seems like unecessary to create and delete those tables every time. Just create them and that's all. Tables names and field names are same at each time you run the program, aren't they?
If yes, why to delete them and recreate them at each time.
Explain the target of the program and database use, so we will answer you more precisely.
Shay Noy
|
|
|
|
|
I do not delete the tables every time. They only need to be created once.
The application is for salesreps and they would add additional information about their clients that the accounting package doesn't cater for. The reason why I want to add the table creation in the code is so that I do not have to create the tables manually each time the application is run at a different site.
Am I going at it the wrong way?
|
|
|
|
|
Understood. I think that it is a good approach. The creation should be when loading but you have to check if the tables do not already exists and if they already exists just skip the creation step.
You also can think on a way how to create the tables in a setup project and not inserting the creation into your project.
Anyway, also then you will have to check that the tables are not yet created to prevent from crashing program.
Shay Noy
|
|
|
|
|
Thanks for the response - I'll look into putting it in some sort of a setup process.
|
|
|
|
|
Hello Experts!!
My problem is- "select * from data" i want to show result of this query on to crystal report.......I am using msaccess for a database.
|
|
|
|