|
I might have found the solution. I tried "ex.TargetSite.Attributes" and it gave me a unique number for the exception.
I haven't fully tested it but i hope this might work.
If you know anything about this share it with me.
|
|
|
|
|
I have this code in VB6 but I don't know how to change into VB.NET ?
Private Declare Function GetFocus Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Integer) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Const WM_CHAR As Long = &H102
Private Const CH_A As Byte = 65
Private Sub Command1_Click()
Dim handleactive As Long
Dim recString As String
Dim handle As Long
handleactive = GetFocus()
'Call Shell("c:\windows\system32\cmd.exe", vbMaximizedFocus)
'handleactive = GetActiveWindow()
handle = FindWindowEx(0, 0, "ConsoleWindowClass", "C:\WINDOWS\system32\cmd.exe")
DoEvents
SendMessage handle, WM_CHAR, vbKeyC, 0
SendMessage handle, WM_CHAR, vbKeyD, 0
SendMessage handle, WM_CHAR, vbKeyReturn, 0
recString = String(100, Chr$(0))
GetWindowText handleactive, recString, 50
Text1 = recString
End Sub
Thanks for your helping!
Hung
|
|
|
|
|
I have a Panel Control containing a PictureBox in it
If I set a picture for PictureBox and the size of the PictureBox is large enough to show the ScrollBars of the Panel control
Infact I am trying to add the scrolling functionality to My PictureBox and scroll it programmatically
How do I programmatically set the values of the ScrollBars of the Panel control such that the center of the PictureBox is in the Center of the Panel control.
I have used the AutoScrollPosition property of the Panel control, but, can't find the solution to my problem (how to scroll to the center)
I hope you understand my problem
Hoping for a quick reply
Thank You
-- modified at 13:40 Friday 16th September, 2005
|
|
|
|
|
You might like to set scrolling position of scrollbar at some event.
E.g.
you can set X and Y positions.
- ashish
|
|
|
|
|
I want this functionality by using the panel control only (as I stated)
Thank You
|
|
|
|
|
I talked about Panel control only.
- ashish
|
|
|
|
|
Hello
How do I determine the values of X and Y, since, I don't know how the values of X and Y work
Thank You
|
|
|
|
|
I am developing an application that needs to figure out how many monitors are available and it will populate a listbox with the monitor options. When one of the monitors is chosen e.g. Monitor 2, it should move a form to that window.
Could someone please tell me how to do this in VB.NET? Or are there any examples out there where something similar to this is done in VB.NET?
Thanks for all your help.
Yemi
|
|
|
|
|
You can find some information in the following class...
System.Windows.Forms.SystemInformation
Including getting the monitor count and the primary dispaly...
System.Windows.Forms.SystemInformation.MonitorCount
But I'm afraid that's as much as I know.
|
|
|
|
|
Hi all..
I'm trying to replace a item in a Listbox, but for some reason it does'nt work... ;(
ListBox1.SelectedItem = "Some|Text|Text|Text"
For some reason my "ListBox1_SelectedIndexChanged" will brake..
Dim ConfigData As New ArrayList(Strings.Split(ListBox1.SelectedItem, "|"))<br />
ProjectName.Text = ConfigData(0)<br />
SourcePath.Text = ConfigData(1)<br />
ServerPrjPath.Text = ConfigData(3)<br />
LocalPrjPath.Text = ConfigData(2)
shame ,Gerrit
-- modified at 12:29 Friday 16th September, 2005
|
|
|
|
|
I haven't properly understood what's the matter here.
You have a problem in "replacing" an item in the listbox as you state in your first line or with the SelectedIndex changed (not affected by changing an item) or something else?
|
|
|
|
|
.. sorry..
Well it shoud be something to have diferent configuration paths.
In the Listbox there are diferent Strings like:
Projektname0|Path1|Path2|Path3
Projektname1|Path1|Path2|Path3
Projektname2|Path1|Path2|Path3
Projektname3|Path1|Path2|Path3
On Listbox1_SelectedItemChanged I take the actual selected Item and Place the Diferent Strings to the Interface.
.. now to my problem...
When I take the changed Path from the Interface and want to put them at the selected Item Pos....
ListBox1.Items.Item(ListBox1.SelectedIndex) = ProjectName.Text + "|" + SourcePath.Text + "|" + LocalPrjPath.Text + "|" + ServerPrjPath.Text
.. well I'm not shure if he's doing this.
When I step through this it seems to be okay, but Listbox1.SelectedItem doesnt exist anymore.... and the event SelectedIndexChanged is running for some reason??....
Dim ConfigData As New ArrayList(Strings.Split(ListBox1.SelectedItem, "|"))
ProjectName.Text = ConfigData(0)
SourcePath.Text = ConfigData(1)
ServerPrjPath.Text = ConfigData(3)
LocalPrjPath.Text = ConfigData(2)
When I set a Breakpoint at DIM ConfigData and step through... everything is "" Empty... but Why..
,Gerrit
|
|
|
|
|
I'm not sure but it maybe that when you change an Item (like you do) the SelectedItem property gets cleared. Try to BP just after the ListBox1.Items.Item(ListBox1.SelectedIndex) = and see what's the value of SelectedItem now. And check also SelectedIndex if it goes to -1 (no item selected).
If SelectedIndex is still valid but SelectedItem goes blank than you can easily fix it with:
Dim ConfigData As New ArrayList(Cstr(ListBox1.Item(SelectedIndex).Split( "|"))
If also SelectedIndex is cleared you should save it before to a temp variable and restore it just after setting the item value.
hope it helps
|
|
|
|
|
Could anyone give pointers to how i can combine unicode characters in vb or vbscript. I intend to combine the lattin small and capital letter e with an acute/grave with a dot below. thanks
larry_larry
|
|
|
|
|
Hi all,
I have discovered a very strange, if not disturbing, behavior performing a simple calculation using Single datatypes in VB.NET.
Here's the code:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Single = 0.3
Dim y As Single = 0.05
x += y
x -= 0.35 ' Test if this value is present in calculations
End Sub
If you step through this code while watching the values of x and y in the Locals or Watch windows, you will see that x = -0.3, y = -0.05, and x += y produces x = 0.350000024. This doesn't occur using doubles or decimals. The MSDN help says, '...Single-precision numbers store an approximation of a real number.' I'm not sure of exactly what they mean by 'an approximation'?
I work for a financial company, and we are all quite baffled by this. Any comments or ideas will be greatly appreciated!
Thanks
|
|
|
|
|
Financials should be using the Decimal type. It's more accurate than any number stored in IEEE 754 format, which Single is. This is NOT a problem with Visual Basic .NET. This is a limitation of the IEEE standard used to store floating point numbers.
IEEE 754: Standard for Binary Floating-Point Arithmetic[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the information
The 754 standard link you sent has some outdated links that would otherwise point to more detailed information. However, I'm a bit purplexed regarding this arithmetic containing an error as large as 24 parts per billion, especially considering that a Single in .NET is capable of 45 decimal places for negative numbers! Financial calculations aside, this is huge error for a type capable of representing this many decimal places, isn't it?
|
|
|
|
|
Anonymous wrote:
especially considering that a Single in .NET is capable of 45 decimal places for negative numbers!
I think you're refering to the range of negative 3.402823e38 to positive 3.402823e38. These are the absolute limits of the numbers a Single can approximate. But since it is only 32-bit long, it cannot do it accurately. Under the 754 format, the 32-bit binary representation is actually holding two numbers that fill in an exponent formula that approximates the value you want. This is where the inaccuracy comes from. Since there is limited space to hold these two values, there is very limited precision.
This is by no means the fault of Microsoft and the .NET Framework. This is the standard format that has been used in Intel processors for decades.
There are other number formats that offer greater precision, but eventually, they all suffer from the limitations of binary math using in a finite numerical storage width.
If your doing financial calculations, you have to have a greater understanding of the data types your platform uses (Intel/.NET Framework), what standards those types follow, and what the limitations of those standards and types are. Then you'll be able to select the datatypes and coding techniques that will limit math errors within controlable specifications, if not eliminate them for you, depending on your requirements.
A Single is an IEEE754 32-bit signed value.
A Double is an IEEE754 64-bit signed value.
Here's the scoop on the Decimal type, straight out of the Docs on MSDN:
The Decimal value type is a 128-bit representation of decimal numbers ranging from positive 79,228,162,514,264,337,593,543,950,335 to negative 79,228,162,514,264,337,593,543,950,335. The Decimal value type is appropriate for financial calculations requiring large numbers of significant integral and fractional digits and no round-off errors.
A decimal number is a signed, fixed-point value consisting of an integral part and an optional fractional part. The integral and fractional parts consist of a series of digits that range from zero to nine (0 to 9), separated by a decimal point symbol.
The binary representation of an instance of Decimal consists of a 1-bit sign, a 96-bit integer number, and a scaling factor used to divide the 96-bit integer and specify what portion of it is a decimal fraction. The scaling factor is implicitly the number 10, raised to an exponent ranging from 0 to 28.
Therefore, the binary representation of a Decimal value is of the form, ((-2^96 to 2^96)/ 10^(0 to 28)), where -2^96 is equal to MinValue, and 2^96 is equal to MaxValue.
What this means is that the Decimal type has the capability to adjusts it's precision to match the requirements of the value. If you have an extremely large number, you usually don't have a need to be accurate to the right of the decimal point. The opposite is also true. For very small numbers, precision to the left of the decimal gives way to precision to the right of it.
I highly suggest reading this[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm currently developing a VB.NET application and I intend to completely deny users access to the database (i.e making it impossible for users of the application to see the database file e.g mydatabase.mdb) in the installation directory.
If this objective can be achieved, what database would you suggest,and how do I abstract it from the user?
lutherium - feel the weight of object-oriented programming
|
|
|
|
|
have you considered putting a password on the database?
|
|
|
|
|
Just a thought....
You can use XML files to store your data and can encrypt the XML files. After encryption, user can access the files, but will not be able to see the data.
- ashish
|
|
|
|
|
Hi,
How to create a webbrowser in VB.net including Fav, View Source ....
Thank you
|
|
|
|
|
You can add COM component, something called AxBrowser to have capabilities of browser in VB.NET.
Check if it works for you...
- ashish
|
|
|
|
|
1) We have the ChannelSecure SiteMinder agent that provides login authentication to external users of the application
2) After user logs in, an HTTP request is generated for the Redirect application that sits on the DMZ. This is a web application that implements the IHttpHandler interface. It performs URL rewriting and generates request to the AES application. It also routes the response from the AES application back to the client.
3) Now after the session times out, and the page is posted, we get a HTTP 404 Page not found error. We have a mechanism to redirect the user to an error or login page if the session times out. But in this case, it does not seem to work.
4) HOWEVER, after you get the 404 error, if you simply refresh the page, it redirects to the logout page.
5) There are exceptions being thrown and caught when the session times out.
|
|
|
|
|
hi all;
I want when I load my programme(EXE) in vb.net count how many times I load it.
THANKS;
Please replay or.send
amr_cis@yahoo.com
|
|
|
|
|