|
As long as you're using this just for display purposes, it's OK to do. Realistically, you should catch the error as close to the possible source as possible so it can be properly handled (cleanup, retries, etc.) since that's the only place where you will actually have any meaningful context around the error. Don't use a global exception handler like this for anything other than unhandled exceptions.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
I am developing an application using VB.Net. There are two pages in my application:
1. First page is a search results page.Search result is displayed in a grid. First column of the grid is User Id which is a linkbutton. On click of some User Id it will redirect to selected user details page.
2. Selected Users Details page is second page. This page contains 5 tabs. Body of each tab contains a link called Back to Search Results.
On click of this link i want to redirect to search results page. Search results should be displayed without hitting the server again.
Please help me to solve this problem using javascript or vb.net code...
|
|
|
|
|
Hii ,
How can we disable the sort feature in datagridview in windows application or the functionality shouldnot work at runtime ?
How can we hide the edit icon on Row header -> ????
How to hide the * at design time of datagridview ??
Thanks & Regards ,
|
|
|
|
|
Disable the sort feature as follows:
<br />
For u = 0 To 11 'number of columns<br />
DataGridView1.Columns(u).SortMode = DataGridViewColumnSortMode.NotSortable<br />
Next u<br />
With regard to questions 2 & 3:
Set all 'AllowUser'-functions in the properties window to False.
Good luck.
|
|
|
|
|
hi all
i m working on a richtextbox. let me explain my problem
the richtextbox contains some text. now i create a form that provides printing facility to print the contents of richtextbox (i have certain reason of doing so.)
when it comes to provide the page range (page to - from) how can i handle that. i tried to control it by properties but it shows the wrong printing result. how can i determine the total pages, (some how i manages to get this) but the page range is a problem to me.
can some one guide me
thanks in advance.
help everyone
Falling down is not defeat...defeat is when u refuse to get up...
|
|
|
|
|
I have created a project which has one control which accepts certain media files like .mpg, .avi, .pps (power point viewer), .swf (Flash file), .jpg etc.
Now what happens is once I run that executable (my project) and browse certain file and open them.
After that for all those files, which I had opened, default application was set my project executable.
Means when I directly open .pps file, my project executable is get opened.
I think my project has set certain attain attribute/settings in windows.
Anyone has any idea to remove this settings?
Thank you
|
|
|
|
|
Hi!
I am populating a treeview on fly from DB on pageload. the treeview looks like
Motor
|
|-Holden
| |
| |-Astra
|
|-Subaru
the treeview is dynamic. I want to maintain the selected node when i navigate away from one page to another. If i select "Astra" in page 'A' and do postback it maintains the selected state using session("selected") = tv.selectednode.valuepath
but, if navigate to page 'B' in page load in my below line
If Not Session("selected") Is Nothing then
debug.writeline(Session("selected")) -->prints 118/115
propertytn = Me.tvProperty.FindNode(Session("selected")) --->nothing
propertytn.selected = true
i get null reference when i try to find that node and select it.
I spend few days trying to figure out, posted everywhere but no one is giving me satisfactory reply
somewhere i read i should expand parent first before expanding child. but again how would i expand all the parents if the selected node is in 6th level in a treeview.
please help.
|
|
|
|
|
If you are getting node returned from FoundNode you may have an EnsureVisible (it's on some winform controls).
If this is not available then you should be able to work with the foundnodes parent node, walking up the tree till you get to the root node, expanding at each step.
If you can't expand from the bottom then put each node into an array of node and when you reach the root node you have a list of nodes to expand from the top.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi!
thanks for reply. I think the node becomes only available when I drilldown (by the look of my code). i.e it has treenodes populateondemand. could you possibly point out what i am doing wrong to acheive my goal. am i populating the treeview incorrectly? please help
brief code as below
sub page_load
if not ispostback then
PopulatePropertyLocation()
end if
If Not Session("selected") Is Nothing then
debug.writeline(Session("selected")) -->prints 118/115
propertytn = Me.tvProperty.FindNode(Session("selected")) --->nothing
propertytn.selected = true
end sub
----------------------------
Private Sub PopulatePropertyLocation()
Dim myDal As New clsDAL
Dim dt As DataTable
Try
dt = myDal.getPropertyLocation(userId, tLocId)
PopulatePropertyLocationNodes(dt, tvProperty.Nodes)
Catch ee As Exception
Throw ee
myDal.UpdateErrorLog(ee.Message, ee.TargetSite.Name.ToString())
End Try
End Sub
Private Sub PopulatePropertyLocationNodes(ByVal dt As DataTable, ByVal nodes As TreeNodeCollection)
For Each dr As DataRow In dt.Rows
Dim tn As New TreeNode()
tn.Text = dr("LName").ToString()
tn.Value = dr("LId").ToString()
nodes.Add(tn)
'If node has child nodes, then enable on-demand populating
tn.PopulateOnDemand = (CInt(dr("LocationCount")) &gt; 0)
Next
End Sub
many thanks in forward.
|
|
|
|
|
|
I used the dataTable.Select method to get a single row from a dataTable. Now I need to get the value from the stud_id column in the dataRow. I tried to do the following and I get the blue Line under
foundRow("stud_id").
intStudID = foundRows("stud_id") ' this line of code did not work, why?
How do I get the value of the stud_id column in the dataRow.
Here is my code.
' global variable declaration<br />
' create dataRows<br />
Dim foundRows() As Data.DataRow<br />
<br />
' a part fo the code in sub procedure<br />
Call GetRowsByFilter("tbl_lessons", "less_time = " & startTime & "AND less_day = " & arrDayNum(intArrCount))<br />
<br />
<br />
Private Sub GetRowsByFilter(ByVal tableName As String, ByVal exp As String)<br />
Dim dt As DataTable = lpDataSet.Tables(tableName)<br />
<br />
' Use the Select method to find all rows matching the filter.<br />
foundRows = dt.Select(exp)<br />
<br />
End Sub
|
|
|
|
|
AAGTHosting wrote: foundRows("stud_id")
This is an array of rows and you are defining the row number as "Stud_id", try
foundRows(0)("stud_id")
This will get you the first row (0) and the column ()("stud_id")
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am having an issue that seems to be specific to a single input source. I select a group of rows from a table and based on some matching determine that they are duplicates for my purpose. I fill an arraylist with the actual datarows and then after I am finished with all of the logic of determining the duplicates, I remove them like this.
For Each duplicateRowToRemove As DataRow In rowsToRemove<br />
duplicateTable.Rows.Remove(duplicateRowToRemove)<br />
End If<br />
Next
I receive the RowNotInTableException or some version of an IndexOutOfRange exception everytime. I have tried adding a primary key by just incrementing a counter and inserting it in the "ID" column, I have tried to check whether a row exists in the arraylist before adding it, I have tried to check to see if the row exists before removing it and nothing works. What am I missing here? This code has been in place for 4 months with no issues until today's input source (file) came in.
FYI - I can still run previous files but this one keeps causing the process to exception out.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
You should not attempt to remove items from a collection when performing a For Each through the same collection. Use a For loop to traverse the collection in reverse order, removing the items as you go.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
Have you tried usong the almighty Google[^]? 536,000 results to do what you are asking, in 5 seconds
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
I tried using Google but i didn't get the required solution for my problem.
If u know the solution u answer it instead of criticizing
|
|
|
|
|
Jeminwins wrote: I tried using Google but i didn't get the required solution for my problem.
Ok. You will rarely find the "required solution" for your "problem." That is part of being a developer. You need to be able to do the necessary research for your project, and then apply what you learned to your project and tailor it to meet your needs.
Jeminwins wrote: If u know the solution u answer it instead of criticizing
Don't tell me what to do. I'm not going to answer a damn thing for you. I wasn't criticizing you. I simply told you to look on google, because there were thousands of articles that you could have read, learned from, and applied to your project. Instead of doing that, you came to code project and listed your requirement and expected someone to do your work for you. There wasn't even a question in your original post to answer. This isn't rent-a-coder. Do the damn research yourself, and when you get stuck at a specific spot, you can ask a specific question.
What have you tried to do to solve that solution, huh? Maybe barely search google for your exact solution, with full source code? Go to every forum you could think of and list your requirement, with no questions, and expect someone to waste their time doing your work? We help for free, when we feel like it. Why would someone help you, when you probably haven't tried to solve the problem yourself. Lazy ass Indian. That is why Indians get such a bad rep. People like you. You act like everyone owes you something. You believe we should do your work, research, and write code for you. You lazy ass. I can't believe people like yourself call yourself a developer.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Justin
I do love a good dummy spit . Onya lad
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
In vb.net 2005 we can not use oracle database 8.0.5 at desing time.For this we need to use the connection string at run time to execute queries.
I have a customers form and using treeview to display the customers and by selecting the customer from the treeview I need to show the detail of the selected customer in the controls like (TextBox,ComboBox).I can get the detail by running the following query but don't know how to bind the controls after getting the result.
Using the following query to get the result of the selected customer.
"Select * from customers where custcode = '" & mcustcode & "'
Any idea or any sample code which can help.
Thanks In advance
Ejaz
|
|
|
|
|
Explaining the basics of data access in .NET is beyond the scope of a forum post. I suggest you buy a beginner's book on VB.NET and ADO.NET.
A quick Google search[^] also threw up some articles you may like to read.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Try something like this :-
myTextBox.DataBinding.Add("Text", myDataSet.Table(0), "FieldToBind")
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Hi all,
I have a bit of an issue with some code I am designing.
I am trying to implement a "file open" dialog for images. There are reasons for not wanting to use the standard dialogs. Also, I want the control to remain responsive whilst displaying a the list, so a user can select "up", or another folder whilst the list of preview images is loading.
To do this, I have a panel object, and my own "simpleimage" which is a simple control which has an image and a caption. I draw the a small preview thumbnail image to the simple control then add this to the panel.
To keep the app responsive, the creating of these simple images is done in a background worker, and a delegate adds them to the panel.
Delegate Sub AddIconDelegate(ByVal s As SimpleImage)<br />
<br />
Private Sub AddIcon(ByVal s As SimpleImage)<br />
SyncLock Me.ImagePanel<br />
Me.ImagePanel.Controls.Add(s)<br />
End SyncLock<br />
End Sub
and, in the background worker:
Loop through relevant images<br />
Dim Blob As New SimpleImage(MyCL, ImageTypeEnum.Image, FileName, Cap)<br />
AddHandler Blob.ImageSelected, AddressOf ImageSelectedHandler<br />
Blob.Location = New Point(xp, yp)<br />
Me.ImagePanel.Invoke(ASI, Blob)<br />
End Loop.
And the scrollbar:
Private Sub _ValueChanging(ByVal Sender As vScroller) Handles VS1.ValueChanging<br />
SyncLock Me.ImagePanel<br />
Me.ImagePanel.Top = -VS1.Value<br />
End SyncLock<br />
End Sub
This code generally works fine. I have successfully added over 4000 images.
I can mess around with the scrollbar which controls the panels position (move it up and down) and generally things are fine, BUT if I go crazy and move the scroll bar really crazily, the invoked procedure (AddIcon), more specifically the "Me.ImagePanel.Controls.Add(s)" line, will cause a StackOverflowException. This can happen with only 300 icons.
So, Question time.
Does anyone know why this is happening?
Any way of catching the stackoverflow exception?
I have tried slowing the backgroundworker down with a thread.sleep, and this reduces the chance if it happening, but does not eliminate it. The synclock also reduces the chance of this happening.
Thanks in advance.
Jason
|
|
|
|
|
Hi
Is there more code? maybe some eventhandlers on the imagepanel?
and ther's one more thing:
your syncLock is useless
basically you're of coure right that you must lock resources when you modify them from different threads. but since you call your AddIconDelegate correctly via Invoke of ImagePanel it's executed through the main-thread of your application. so no syncLock required here.
but anyway that's not the problem here...
you should take a look at the CallStack in your debugger when the exceptions comes up.. maybe that gives you an idea what's called from where over and over...
greets
m@u
|
|
|
|
|
Hi,
Thanks for the reply.
The Synclock was an attempt at curing the problem, and it does seem to reduce the problem... but then again, maybe it doesnt . I will remove these lines!
There isn't really much more code. The imagepanel has no eventhandlers defined by me, and its only function is that of a container to hold all the other controls. I only access its "Top" value, setting it depending upon a scrollbar position.
The background worker does "report progress" which increments a progress bar on the main thread, but that is about all I'm afraid for the code in the form.
The exact exception reported is rather useless (well, to me and Uncle Google):
System.StackOverflowException was unhandled<br />
An Unhandles Exception of type 'System.StackOverflowException' occurred in mscorelib.dll<br />
Make sure you do not have an infinite loop or infinite recursion.
I certainly dont have an infinite loop, and I cant find out where in mscorelib.dll this is occuring.
Thanks again.
|
|
|
|