|
This may seem like a wierd question. I'm trying to prevent unhandled exceptions that originate from an embedded user control, bubble up to the main form which contains the user control and crashing the app. The catch is, I don't want to have to catch the unhandled exception and handle it.
Sorry if I've confused anyone.
Basically I have a main form, which contains a user control that I've written. I was wondering if there was a way from preventing unhandled exceptions that the user control creates, from stepping up a level and crashing the main form (app). All without specifically catching the exception. Basically I'm asking if there is a way to prevent unhandled exceptions from bubbling up to the main form.
Is this possible? Or will I have to catch every possible exception to prevent it from bubbling up a level and crashing the app.
Thanks.
|
|
|
|
|
It is possible, you just handle your exceptions within the user control. Since you don't want to "specifically catch" the exception. You can use a generic try catch or an empty catch (not the best practice). It also depends if you are going to do anything with the exception.
Try<br />
'some code<br />
Catch<br />
'leave empty<br />
End Try
OR
Try
'some code
Catch ex As Exception
'catch all exceptions
'do something like write to an error log file
End Try
You can try this, but I recommend that you should probably do something with the exception. Otherwise your user won't know what is going on
|
|
|
|
|
If I got it correctly there are several ways to accomplish it. Some are stated in the reply before mine.
I think the point is if you have specific code that can generate exceptions or not. In the first case you should jusy but it inside a try/catch/end try structure to "trap" exception and eventually discard them.
Another way should be (I'm not sure about it but it should work):
Public sub Main
Try
MainForm.Showdialog
catch ex as exception
end try
end sub
or a dirty (and old) way is to put ON ERROR RESUME NEXT wherether it may be needed.
My suggestion is work on the control code and not on the application. For several reasons:
1) It'll be ready for each and every application
2) You don't need to remember it/rehandle it everytime
3) You can always trap exception even if you sub-thread it.
4) It's more clean code style.
Hope it helps.
Briga
|
|
|
|
|
Hi
I have a program that loads some activex components. When I run it as an administrator, there is no problem but when I run it in limitted user accounts, the "ActiveX Component Can't Creat Object." error raises.
I tried to search group policy to solve this problem for the limitted user groups, but I couldn't find anything helpful.
Please help me with that...
Is it possible for a program run in a limitted user account, to load activex components?
Thanks in advance
|
|
|
|
|
Hello to all the community I am working on a fairly big App and now i am using Crystal to build loads of reports... And my question is about the optimal way to work when using crystal. Now i am creating 1 datadapter and table in a dataset (on design time) for each Report (excepting the ones who are very similar)
How do you think about this, ppl?
Thanks for reading.
|
|
|
|
|
Hi,
I'm using VB 6 and Access db. I've created my 1st application, created a package and tried to install it on another pc.
During the installation on the target pc, it says:
"Setup cannot continue because some system files are out of date on your system. Click OK if you would like setup to update these files for you now. You will need to restart Windows before you can run steup again. Click Cancel to exit setup without updating system files."
It keeps giving the error eventhough I choose OK and reboot. Weird.
The Bootstrap files no. 3-7 are causing this error :
File1=@Vb6stkit.dll,$(WinSysPathSysFile),,,3/26/99 1:00:00 AM,101888,6.0.84.50
File2=@COMCAT.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,5/31/98 12:00:00 AM,22288,4.71.1460.1
File3=@STDOLE2.TLB,$(WinSysPathSysFile),$(TLBRegister),,1/13/03 2:49:54 PM,16896,2.40.4518.0
File4=@ASYCFILT.DLL,$(WinSysPathSysFile),,,8/31/99 4:55:18 PM,147728,2.40.4277.1
File5=@OLEPRO32.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,1/13/03 2:49:54 PM,229376,5.0.4518.0
File6=@OLEAUT32.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,1/13/03 2:49:54 PM,929792,2.40.4518.0
File7=@MSVBVM60.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,2/23/04 8:42:40 PM,1386496,6.0.97.82
If I remove 3-7, I get pass the installation, but upon running the program, I get an error, " The data binding DLL, 'VB5DB.DLL' could not be loaded." Probably caused by the removal of the above bootstrap lines.
Any thots will be appreciated on how I can solve the problem.
Gurdip
|
|
|
|
|
hi there , is there a way to subtract 1 column from another column(as in the cells in the columns substract) and passing the result of cell subtraction onto another spread sheet ??
|
|
|
|
|
use the sheet address before the cell address, such as:
(From a multi-sheet XL spreadsheet with the sheets called "Sheet1" and "Sheet2", respectively:
put the numbers 1 and 3 in cells "A1" and "B1", respecively, of "sheet1", in a cell in "sheet2" (or whatver sheet you want the calculated answers to appear in), put the following to do calculations:
=Sheet1!B1-Sheet1!A1
The answer should appear on "sheet2" (or whatever sheet you put the calcs in) in whatever cell you choose to do the formula in, and it should say 2. Simply put the "SheetName" and an exclamation point ("!") before the cell reference, not in quotes, though. Hope this helps!
Richard
|
|
|
|
|
hi
i am using from adodc ond in data link properties
in database name have typed :Application.StartPath & "../vb2/db1.mdb"
vb2 is folder of project and database.
but there is an error :operation cannot be complate and error of provider too
in provider i select :microsoft jet 4.0 ole db provider
please help me
thanks
|
|
|
|
|
Hi All,
I am writing VBScript files. Examples in MSDN about Word Automation Model are in the form
ActiveDocument.Envelope.Insert Address:=strAddr, ReturnAddress:=strReturnAddr, Size:="Size 10"
But if I put them in a vbs file then it pops up an error saying that method Insert is invalid. How do I convert these Address:= and size:= values for a vbscript file to run
Regards
|
|
|
|
|
I know you can do
dim MyFirstArray() as string
dim MySecondArray () as string
MySecondArray = MyFirstArray.Clone
Works no problem.
It does not seem to work with the following
dim MyFirstArray(,) as string
dim MySecondArray (,) as string
MySecondArray = MyFirstArray.Clone
I could do a loop and copy that way but there must be a way in VB.Net
What am I doing wrong or can anyone else have any suggestions on how it is done.
|
|
|
|
|
When I try the following
dim MyFirstArray() as string
dim MySecondArray () as string
MySecondArray = MyFirstArray.Clone
I get this error
"Specified cast is not valid."
Strange enough, if I do it in the command window, it works. Getting confused
|
|
|
|
|
Hai...
I want to do some programming like recording voice from vb or vb.net and save int .wav format. Please give me guide how to do, or give me some links, or give me code which is already available.
Thanks,
E.Veera Raghavendra
e.veera raghavendra
|
|
|
|
|
Hi,
my work hierarchy is as follows.
sqlStr = "select * from voucherTransaction where CompanyCode='" & compCode & _
"' and vtCode='" & mcmbVoucherType.SelectedItem.col1 & "' and
voucherNo=" & txtVoucherNo.Text
parameter.Value = sql // sqlCommand parameter object
davd.SelectCommand = cmd // cmd is sqlCommand and davd is sqlDataAdapter object
davd.Fill(dsvd, "voucherDetail") // dsvd is DataSet
davd.Dispose()
//after populating dataSet i need to delete a specific row . and the deletion
code is
dsvd.Tables("voucherDetail").Rows.RemoveAt(lastRow)//lastrow is secific row no
dsvd.Tables("voucherDetail").AcceptChanges()
//now i need to add new row as
dsvd.Tables("voucherDetail").Rows.Add(drow) // drow is DataRow
//now updating the DataSet as follows
sqlStr = "select * from voucherTransaction where CompanyCode='" & compCode & _
"' and vtCode='" & mcmbVoucherType.SelectedItem.col1 & "' and
voucherNo=" & txtVoucherNo.Text
parameter.Value = sqlStr
davd.SelectCommand = cmd
Dim cbvd As New SqlCommandBuilder(davd)
davd.Update(dsvd.Tables("voucherDetail"))
davd.Dispose()
Now the error is " can't insert the duplicate key value"
I have displayed the DataSet table (voucherDetail),there isn't any duplicate value but its showing error for that specific row because its not deleting from the database.
Please help me immediately if u have some suggestions
|
|
|
|
|
Hello
When executing my script, I get this error. I dont understand what the error is about....
Could anybody explane to me what it means
"The callee (server [not server application]) is not available and disappeared; all connections are invalide. The call did not execute"
Spaz
|
|
|
|
|
Hi friends
I am trying to build a windows application which uses crystal report to generate reports. In this report I am using SQL Statement. What is the procedure to pass parameter at run time. I am using Crystal Report built into Microsoft VS.NET 2003. Please some body help me.
Tutul
|
|
|
|
|
//Create report object like
Dim crobj As New MyReport // Myreport is reportName
//and the pass the values to the parameters as below
crobj.SetParameterValue("startDate", startDate)
crobj.SetParameterValue("endDate", endDate)
CrystalReportViewer1.ReportSource = crobj
CrystalReportViewer1.Show
//if you have stored procedure parameter then place "@" before parametername like
crobj.SetParameterValue("@endDate", endDate)
Its working
hope it'll help
|
|
|
|
|
Why does VB.NET & many other programming languages reserve 2 bytes for the boolean data type although one byte is enough? I was told that 32-bit processors are not capable of directly working with a 1 byte value & would have to transform them into 2-bytes values. Is that true? if so why?
Thanks in advance
|
|
|
|
|
I have been trying to get my listview to show an icon on the right side of the header if that column has been clicked. So far I have had almost no luck. Any links to one would be great. Showing code would be good too. I know I had found one once, but I can not find it again.
Thanks
|
|
|
|
|
I have this code that I found, but I keep getting a Nullreference error.
Declarations
Private Declare Function SendMessage Lib "user32" _<br />
Alias "SendMessageA" _<br />
(ByVal hwnd As IntPtr, _<br />
ByVal wMsg As Integer, _<br />
ByVal wParam As Integer, _<br />
ByVal lParam As HD_ITEM) As Long<br />
<br />
Const LVM_FIRST = &H1000<br />
Const LVM_GETHEADER = (LVM_FIRST + 31)<br />
<br />
Const HDI_BITMAP = &H10<br />
Const HDI_IMAGE = &H20<br />
Const HDI_FORMAT = &H4<br />
Private Const HDI_TEXT = &H2<br />
<br />
Private Const HDF_BITMAP_ON_RIGHT = &H1000<br />
Private Const HDF_BITMAP = &H2000<br />
Private Const HDF_IMAGE = &H800<br />
Private Const HDF_STRING = &H4000<br />
<br />
Private Const HDM_FIRST = &H1200<br />
Private Const HDM_SETITEM = (HDM_FIRST + 4)<br />
Private Const HDM_SETIMAGELIST = (HDM_FIRST + 8)<br />
Private Const HDM_GETIMAGELIST = (HDM_FIRST + 9)<br />
Private Structure HD_ITEM<br />
Dim mask As Integer<br />
Dim cxy As Integer<br />
Dim pszText As String<br />
Dim hbm As Integer<br />
Dim cchTextMax As Integer<br />
Dim fmt As Integer<br />
Dim lParam As Integer<br />
Dim iImage As Integer<br />
Dim iOrder As Integer<br />
End Structure
Dim hHeader As IntPtr = ShellDll.SendMessage(lstView.Handle, Win32.WindowsMessages.LVM_GETHEADER, 0, 0)<br />
Dim lvImage As IntPtr = ShellDll.SendMessage(hHeader, Win32.WindowsMessages.HDM_SETIMAGELIST, 0, CInt(Me.imgArrows.Handle.ToInt32))<br />
Dim lret As IntPtr<br />
<br />
For i As Integer = 0 To lstView.Columns.Count - 1<br />
'Use the LVM_SETCOLUMN message to set the column's image index.<br />
Dim HD As New HD_ITEM<br />
Dim pblnAlignRight As Boolean<br />
<br />
With HD<br />
.mask = HDI_IMAGE Or HDI_FORMAT<br />
.pszText = lstView.Columns(i).Text<br />
End With<br />
<br />
If lstView.Columns(i).TextAlign = HorizontalAlignment.Right Then<br />
pblnAlignRight = True<br />
Else<br />
pblnAlignRight = False<br />
End If<br />
If i = ColumnIndex Then<br />
With HD<br />
.fmt = HDF_STRING Or HDF_IMAGE Or HDF_BITMAP_ON_RIGHT<br />
.iImage = IconIndex<br />
End With<br />
Else<br />
HD.fmt = HDF_STRING<br />
End If<br />
<br />
SendMessage(hHeader, HDM_SETITEM, i, HD)'error occurs here<br />
<br />
Next
|
|
|
|
|
Dear all professional IT engineer,
Who can teach me how to call database from PDA to local server?
In normal PC application, I know that use system.data.Ole, but I develop for PDA application, there can not Imports System.Data.Ole.
Please help me this.
|
|
|
|
|
How can i send email using outlook; with MHTML body format ?
Looking for help.
Regards,
Asim
|
|
|
|
|
Dears,
My name is Sergio, and I'm from Brazil..
I like go to USA, to work there..
Anyone can send me any enterprises, or any other work??
My email is tejo_pan@hotmail.com
My MSN Messenger is sergio@skale.com.br
I work with:
ASP.NET, VB.NET, SQL Server
Thank you so much..
Sergio Costa Faria
|
|
|
|
|
You need to advertise on the jobs board, and probably apply for the green card lottery.
The big question is, why should someone in the USA employ you instead of someone who is already there ? I do a lot of work for people in the USA, I attract it through my articles and so on. If you're not visibly doing anything to show that you have any skills, I don't see any reason why anyone in the USA would go out of their way to employ you before you're in the country, as a legal resident. Then they will judge you on your merits in person.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How to catch the cell change event in a datagrid?
I have a datagrid filled from a table. I want to raise the cell change event when the user change the value of the cell and get the new value.
|
|
|
|
|