|
For some reason, null is called Nothing in VB. There is another quirk, also. You can not compare a reference to Nothing, you have to use the is operator:
if not cn is Nothing Then
---
b { font-weight: normal; }
|
|
|
|
|
Hi VB community,
I am writing a new project "X2" in VB.Net (Visual Studio 2005). I have the "xyz.dll" ( several functions ) in Windows folder. I have the source code in project "X1" in VB6. I tried to declare and to use the "xyz.dll" in VB.Net in the same way as in VB6. No way. Converting is useless to me because I just start to learn VB.Net. Maybe someone know how to write ( in general ) the delaration part and the implementation part for the *.dll functions.
Thanks for any sugesstions.
sbststtswbwgf
|
|
|
|
|
It's just about the same way as done in VB6, the major differences being that some datatypes mean different thing in VB.NET than they do in VB6. An example of which is a Long in VB6 is a 32-bit signed integer, while a Long in VB.NET is a 64-bit signed integer. They're not interchangable!
What does both your VB6 and VB.NET declaration code look like?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
Thanks for the advice. Now the VB.Net code start to fly.
sbststtswbwgf
|
|
|
|
|
Helloooooooo Everybody......
I need to add a Column to my Access DB during runtime.Using the Columns.Add Function Column gets added to the Dataset but is not updated in actual database after using Adptr.Update Function.I m using Disconnected Architecture of ADO.NET.Is the Update function just to Add or update the 'Rows' of DB & not for 'Columns'? If this is true then pls tell me how to add a new column in DB.
Your Reply is as important as Sachin Tendulkar to the Indian Cricket Team.......
Thnx a lot !!!!!!!!
|
|
|
|
|
Use the alter table command in an sql query to add a field to the table.
Altering the database design in runtime is almost always an evidence of poor database design, though.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa,Thnx for ur reply ..............
|
|
|
|
|
Hi all,
Can any one plz tell me is there any method to call or use data reports in VB.Net or ASP.Net
Plz help me.
Awaiting for ur kind feedbacks
Live Life King Size
Asif
|
|
|
|
|
What do you mean by "data reports"? Where is this report comming from? Crystal Reports? Microsoft Operations Manager? An old VB6 DataReport control?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi RageInTheMachine9532,
I mean VB6 DataReports,I want them to have in VB.Net can u help me.Plz....
Live Life King Size
Asif
|
|
|
|
|
aseef wrote: VB6 DataReports
What on earth for????
The DatReport is part of the VB6 RunTime and not available to VB.NET. Its basic functionality is in the DataGrid in VB.NET. For a more advanced version, look into using Crystal Reports.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
See I dont have any intrest for getting datareports in vb.net but my sh*t client wants the sh*t of data reports in his application.
Plz help me if u can
Live Life King Size
Asif
|
|
|
|
|
Sorry, but it's a designer for VB6. It doesn't work in VB.NET.
If your client wants that specific functionality, you'll have to write your app in VB6.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello, currently i'm import a database from microsoft access. Let say the file is BIBLIO.MDB.The data has 5 column with 156 row. I can display sort of datas in the listview. But, the problem here is how can i choose a row and display the data's in five different textbox(remember i have 5 column which is 5 fields of data) just by double click at the firs row (letsay the product ID or the row ID..e.g 1,2,3,4...156). I want to display it in the different textbox so i can use it to calculate some other mathematic problem. Furthermore by choosing using "double click" method it's more convinient for user to choose which row of data that they want.
Hopefully to hear from you soon.
Thank You
Thank, very much.
|
|
|
|
|
Not aware of listview events. However, the same can be done using a Datagrid. Get all the data in the Datagrid and use the Datagrid_MouseDown event to access records on mouse click.
With Best Regards,
Mayur
|
|
|
|
|
hi all,
i am trying to make a time control page, at a certain interval (example 10 seconds) it will fire the event.
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
'my_code runs every 10 seconds
End sub
my problem is, if the process in then TimerFired runs more than 10 seconds, it will halt the current process and fire the event again and it will runs from the start, how can i lock the process and let it run the code fully in the TimerFired without being interuptted? then only re-fire the code in the TimerFired again? thanks in advance
elcheah
|
|
|
|
|
You could disable the timer at the beginning of the event handler and then re-enable it at the end. That is if you don't mind the interval drifting a bit.
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
myTimer.Enabled = False
' Do something...
myTimer.Enabled = True
End sub
Or you could block an interrupting event's entry by using a simple flag. An old school approach.
Private m_isBusy As Boolean = False
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
If (m_isBusy) Then Return
m_isBusy = True
' Do something...
m_isBusy = False
End sub
|
|
|
|
|
thanks for the fast reply! i have tried the old school approached but it does not work, coz
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
If (m_isBusy) Then Return
m_isBusy = True
' Do something...
m_isBusy = False <-------
End sub
i could not reach the code above and it is already interupted, and it end up without firing the TimerFired event anymore, and the 1st method works fine, thanks alot...
|
|
|
|
|
I'm surprised using a flag didn't work for you. As long as you check the flag at the top of the method and it doesn't ever return out before clearing the flag, it should work. Or perhaps an exception is being thrown and being caught somewhere else in the code? That would prevent the flag from getting cleared at the bottom too.
In any case, I'm glad you got your code working using the other method. If you're happy with it, then I am too.
|
|
|
|
|
hi,
i have another question, why is it the program still keep firing the TimerFired event, when i try stop the TimerFired event after caling myTimer.enabled?
|
|
|
|
|
elcheah wrote: why is it the program still keep firing the TimerFired event, when i try stop the TimerFired event after caling myTimer.enabled?
It shouldn't. If you disable the timer like this...
myTimer.Enabled = False
...then it shouldn't be calling that method anymore.
Perhaps your timer is being re-enabled elsewhere in your code?
Perhaps you have another timer being handled by that same method?
How are you setting up your timer anyways? The code you showed doesn't have a Handles keyword postfixed to the method, which tells me that you're not setting it up via WithEvents. Are you using AddHandler instead? Or a delegate?
|
|
|
|
|
ya, i am using AddHandler in Page_load,
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
AddHandler myTimer.Elapsed, AddressOf TimerFired<br />
<br />
End sub<br />
<br />
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)<br />
' My_code<br />
End sub
then i control the timer with 2 buttons (start,stop) by using MyTimer.Enabled = True,MyTimer.Enabled = False. Is that a wrong way of coding?
|
|
|
|
|
Now we're getting somewhere. :->
I see a few possible issues here.
(1)
You need a RemoveHandler for every AddHandler that you have. If you don't call RemoveHandler, then your timer will continue to persist in memory, even after your form has been closed. This is because a reference is still being kept alive by the AddHandler function.
The best place to call RemoveHandler is in your form's Closed event handler.
However, an even easier solution is to use a timer control on your form instead, via the designer. The designer will automatically declare the timer member with the "WithEvents" keyword, which automatically hooks up event handlers for you at compile time. When you select its Tick event from the IDE's drop down box, it'll insert that method postfixed with the "Handles" keyword.
(2)
Watch out when using the System.Timers.Timer class. By default, this timer operates on another thread which can cause race conditions when used on a form. You can avoid this issue by synching the timer to your UI's thread. However, an even easier solution is to use System.Windows.Forms.Timer instead, which is a control that's selectable in the UI designer, under the Form section.
(3)
You shouldn't use Timer.Enabled to block access to the TimerFired() method if you're controlling the timer enable from the Form too. This could put the timer in a bad state. Instead you should use a flag like I stated before, which should work once you fix the above issues.
|
|
|
|
|
hi, i have trouble with the 1st issue u mentioned, can you show me a simple piece of code on how it is done? i have tried but counldn't get it done Thank you very very much ...
|
|
|
|
|
You need to handle the Form Closed event. The IDE will automatically create this method for you by going to the form source code, select (Form Events) from the top left combo box, and then select Closed from the top right combo box.
Then you can remove the event handler as follows...
RemoveHandler myTimer.Elapsed, AddressOf TimerFired
Notice how it looks similar to your AddHandler. All you have to do is copy your AddHandler line and replace Add with Remove. It's important that the object reference and the method address exactly match the AddHandlers parameters.
|
|
|
|