|
Well, this question is for both VB and C# programers
This is a chapter from C# help that best explains my problem:
Invoking an event: Once a class has declared an event, it can treat that event just like a field of the indicated delegate type. The field will either be null, if no client has hooked up a delegate to the event, or else it refers to a delegate that should be called when the event is invoked. Thus, invoking an event is generally done by first checking for null and then calling the event.
if (Changed != null)
Changed(this, e);
The question is how to make a runtime check in VB (just like in this C# example) to see if any event handler is hooked on that event.
|
|
|
|
|
Actually, it's not a problem at all. VB handles event a little differnetly than C# does. You COULD do the equivilent of C#'s code by doing something like this:
If Not Changed Is Nothing Then
RaiseEvent Changed(Me, e)
End If
But, you don't have to do this at all. When the RaiseEvent statement is executed, it automatically checks to see if there are any subscribers. If there are, then the event is raised with each subscriber, if not, nothing happens.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks David for your reply
If Not Changed Is Nothing Then
RaiseEvent Changed(Me, e)
End If
First line doesn't work cos you can't call 'Changed' directly (in if...then).
You can only write: RaiseEvent Changed (Me,e)
But as You explained to me, I don't need if...then, and that is enough for me .
Thanks Davor
|
|
|
|
|
I am trying to extract word information from vb app.
when I select a particular file like ms word document
I want to get all or a part of text and put it in DB or
another text to display. The thing is in order to load
word document in object I need to open MS word.
If only one file is selected, no problem. However,
I want to manage multiple files( say 100 ) to do the
same thing. In this case I have to open/close word 100 times,
right? I am afraid it will slow the process and I don't
want to see ms word open/close a hundred of times.
I know if I pay the money, there is a couple of solution.
I am not ready to spend my money unless there is nothing
I can do about.
anyone has a solution to this?
|
|
|
|
|
You don't need to SHOW any of those Word documents. Additionally you should do something like this: open word, open doc, get data, close doc, open next, etc.
|
|
|
|
|
Are there any default thread protection objects in VB6? I want to make sure that only 1 function can run on a given block of code at any given time. VB6 is worrying me because everything is event driven and I do not control the threads in the same manner that I would in C++. Can someone point me to some API's or classes already included with VB6 that are similar to a mutex or semaphore?
|
|
|
|
|
Pualee wrote:
Are there any default thread protection objects in VB6?
No, there isn't. There is no multithreading support in VB6 at all. All code and UI updates run on a single thread.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is it possible to format a column in a datagrid using VB.Net to replicate a phone number? I am getting either a 0 or a ten digit number. I would like to display the ten digit number as a phone number in the datagrid (ex:123-456-7899). Is this possible?
Thanks in advance,
Beginner in VB.Net
|
|
|
|
|
Whats with this? Is it possible for code to be removed from a file?
My OS is Windows XP SP-2.
When I click Start and Search the search window opens with the search companion (dog) but there are no input boxes, text boxes, search button or any dialog boxes what so ever on the page. The left and right pains are empty. The window shows the menu bar (File-Edit-View etc) and the button bar along with a search bar and thats it. I can't do a search. Something has stripped the components from the window.
Maybe just a coincidence, but I noticed the problem started after installing SP-2.
Everything else seems to run fine. jscript.dll is present and registered and I have checked the registry for possible errors.
For those interested, more info on this topic visit:
http://www.lavasoftsupport.com/index.php?showtopic=47763&hl=
|
|
|
|
|
And this has what to do with Visual Basic .NET?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a windows application that implements a treeview control of vb.net.This tree has various nodes and subnodes, upon the click of the node, a web page should be displayed in IE...really stuck with this since many days.Please provide help.Thnak you
|
|
|
|
|
I am having a problem in re-ordering the data I am returning to a data set. Briefly, I want the user to be able to re-order the elements of my datagrid using up and down buttons, ie select a row, click up or down to move it!!
Any suggestions
|
|
|
|
|
Ignore me if i got the wrong idea but.
When you click on a row , you could get the index for that row, you could then get the previous or next row index's based on what 'arrow' is clicked and then set the index's to each other.
For eg. If you clicked on row 8, and then click on the up arrow, the code gets index 7, sets row 8 to index 7, and row 7 to index 8, updates the dataset and then calls DataBind refresh the Grid, as to give the illusion of the row moving up or down.
Hope this helps
Chris
|
|
|
|
|
Thanks for that...I had the same idea yest after the post..this is the code I came up with..
Dim cm As CurrencyManager = CType(Me.BindingContext(DataGrid1.DataSource, DataGrid1.DataMember), CurrencyManager)
Dim dv As DataView = CType(cm.List, DataView) ' Retrieve the default DataView of the DataGrid
Dim dr As DataRow ' Use Currency Manager and DataView to retrieve the Current Row
Dim dr2 As DataRow ' setup another datarow variable to store the "move to" line
Dim newOrderNo As Integer ' the temp variable to store the integer for the new row location
Dim currentOrderNo As Integer ' the temp variable to store the integer for the selected row location
'set bounds for the top element on the datagrid
If cm.Position = 0 Then
Me.DataGrid1.Select(0)
Me.DataGrid1.CurrentRowIndex = 0
Exit Sub
End If
dr = dv.Item(cm.Position).Row ' get the details of the row selected
dr2 = dv.Item(cm.Position - 1).Row ' get the details of the row above in the dataset
currentOrderNo = dr.ItemArray(2) ' assign the integer value to a temp variable
newOrderNo = (currentOrderNo - 1) ' decrement the selected row integer value
''''swap the integer values, re-order and move "selected row" up ie work with the same row
dr.Item(2) = newOrderNo
dr2.Item(2) = currentOrderNo
dsDelivery.Tables(0).DefaultView.Sort = "DelOrder"
DataGrid1.Select(newOrderNo - 1)
DataGrid1.CurrentRowIndex = newOrderNo - 1
DataGrid1.Refresh()
|
|
|
|
|
Hi, I want to find any resource on the web on how to use chart control in vb.net step by step. Can anyone provide me some information(URL)?
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
|
Thank you very much for your help, but what i want to do is working with chart control on VB.NET not on a webpage.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
You can, the OWC object will generate a GIF image of the chart, you can do what you want with it. I have used it extensively in both Windows Forms and Web applications. If you get really stuck i'll knock you up a little example if you want.
Cheers
Blu
|
|
|
|
|
Thank you very much for your help, I just found the advertisment in this forum for free .net chart control. Here is it URL[^], but it offer only ASP.NET not VB.NET webform.
BluDog wrote:
I have used it extensively in both Windows Forms and Web applications. If you get really stuck i'll knock you up a little example if you want
If it is possible, please provide me a small example (sample code) to work in VB.NET.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi All
I m currently writing a file comparison utility in VB.NET.
I'd nearly finished the damm thing, then I came across a major issue that's thrown a spanner in the works, and I may need to go back and re-write large parts of the comparison algorithm...
I think my solution is too simple and makes too many assumptions, I'm wondering if anyone has any ideas about how to go around this, or if anyone knows how current programs like WinDiff work?
thanks
Sumit Domyan
Software Developer
ANALEC INFOTECH
|
|
|
|
|
Hi
What kind of output do you want generated? Detailed descriptions of what's different int he file, or just simply that they differ?
IF
|
|
|
|
|
I want each & every details; like different lines will be haighlighted with different colors etc.
Sumit Domyan
Software Developer
ANALEC INFOTECH
|
|
|
|
|
Did you see this article: http://www.codeproject.com/csharp/DiffEngine.asp
my blog
|
|
|
|
|
hello!!
i'm a student of computer science,now a days i'm trying to develop a final project in vb.net.If any one have suggestions ,information and ideas please send to me..
i shall be thankful to u!!
|
|
|
|
|