|
Could there be a threading issue? Try putting a lock around those lines of code.
Since you did not show the error message (just wrote down what you thought it is), it might be something totally different. E.g. the Windows service runs with a different account than your interactive user - and it might not be able to access the folder, because for the service it does not exist: e.g. a folder on a mapped network drive or a UNC path the service's account has no access rights for.
|
|
|
|
|
Hi Bernjard - thanks for trying to help. The exact error message is Service cannot be started. System.NullReferenceException: Object reference not set to an instance of an object.
I had lots of logging put in and it definitely occurs on the first line that tries to set a property of the fileSystemwatcher.
Before I was able to see the actual error and narrow it down to that line of code, I definitely thought about it being a permissions issue. I set the service to run with my own credentials (the same as the windows versions) and it made no difference.
It's interesting that you mention threading because I also tried kicking it off by starting a new thread in the OnStart but that made no difference either.
In all those scenarios I still get a null reference exception whenever I try to set a property of the FileSystemWatcher.
|
|
|
|
|
|
Hello All,
I am new to VBS I have one query regarding the find and replace the entire text file.So kindly help me in this regard will be thankful to all the members.
My Textfile contains the below mentioned lines for example:
1 .1.39 d:\Sandbox\BMW35UP_I390_1.422\Architecture\BSW\CobraModel\project.pj (1.39)
2 .1.39 d:\Sandbox\BMW35UP_I390_1.422\Architecture\BSW\CobraModel\CobraModel_rpy\project.pj (1.39)
3.1.38 d:\Sandbox\BMW35UP_I390_1.422\Architecture\BSW\CobraModel\CobraModel_rpy\CoreDep\project.pj
4./SCS/COBRA/04_Platform/02_Architecture/05_UmlModel/CobraModel/CobraModel_rpy/CoreDeployment/DualCore/DualCore.sbs 1.5 d:\Sandbox\BMW35UP_I390_1.422\Architecture\BSW\CobraModel\CobraModel_rpy\CoreDeployment\DualCore\DualCore.sbs
These are the four lines sample in text file there are around 30,000 lines in the same way.
my question is remove all the lines starting with (Example:1.39,etc(numbers)) and create a new text file with removing the above lines.
Hope i can get response very quickly.
Thank you
Sampath
|
|
|
|
|
You are new to VBS... What regular expression have you tried in any other language?
And, if you want help, show the regular expression you have working and then how you are trying to implement it in VBS.
Tim
|
|
|
|
|
Where exactly are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello !
I'm using vb.net 2013.I have 3 forms : Form1, Form2, Form3
On form1 I have a button . When this button is pressed , the form2 is open.The code inside the click event is :
Dim dlg1 As New Form2
dlg1.Show(Me)
Inside From2 I have a TextBox (Txt1) and a button .When this button is clicked the Form3 is open.The code inside the click event is :
Dim dlg2 As New Form3
dlg2.Show(Me)
Inside form3 I have a button that I use to set a value in the textbox (txt1) on Form2. I use this code :
Form2.txt1.Text="123"
The problem is that after I press the button on form3 , the textbox on form2 is empty , no value is set.
What can I do ?
Thank you !
|
|
|
|
|
Show your exact code. It's impossible to tell what's wrong from those tiny snippets. And put the code between <pre> </pre> tags to preserve the formatting.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
The problem is because of incorrect referencing.
Consider this:
You are creating an Instance of Form2 as dlg1 and then trying to set value inside Form2 (which isn't loaded). This creates a new instance of Form2 and you see the blank values.
Basically what you are trying to do is to return value from custom designed dialog forms - right !
Try this:
Declare a Public Variable in Form1 to hold Form2 value
Public Form2VAL as string
On Form1 Button Click write:
Dim dlg1 as new Form2
dlg1.showdialog
msgbox (Form2Val)
Form2Val = nothing
On Form2 Button Click write:
Form1.Form2Val = "SomeValue"
Me.close
Similarly for Form3, Declare a Public Variable in Form2 to hold Form3 value
Public Form3VAL as string
On Form2 Button Click write
Dim dlg2 as new Form3
dlg2.showdialog
msgbox (Form3Val)
Form3Val = nothing
On Form3 Button Click write:
Form2.Form3Val = "SomeValue"
Me.close
|
|
|
|
|
can anyone help me to create .exe while creating exe its asking demo version sherdian controls i tried many things like threed32.ocx regedit etc but all in vain
error : licensed not found
|
|
|
|
|
zuber ahmed wrote: error : licensed not found Please don't repost. Mycroft[^] is right.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
can anyone help me to create .exe while creating exe its asking demo version sherdian controls i tried many things like threed32.ocx regedit etc but all in vain
error : licensed not found
|
|
|
|
|
Looking at these results [^] and your comments you are trying to use a demonstration versions of a retired tool set, possibly in VB6, a dead language. You may have an unresolvable problem doing that.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It is not clear at all what you are asking.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
thanks for ur response ... i got the registered controls
|
|
|
|
|
Hello Guys.
I have a VBScript and want to copy a file. I want to make sure it finishes successfully.
If the destination-file is set to "read-only" there occures a Runtime Error '800A0046 - Permition denied'.
What I want: I dont want to get the Script-Host error message but instead my own. Therefore I need the error number ( the error code 800A0046 does not work ) so that I can use
On Error Resume Next
IF (Err.Number > 0) THEN
IF (Err.Number = 32755) THEN
...............
as I did it here to check if the user pressed cancel in a open-dialog box.
Since I'm very new to VBScript programming , I don't have any idea where I can look for a solution to problems like this one. So I hope to find help here. I googled a while and also searched in the MSDN but found nothing.
Thank you very much.
modified 31-Jul-14 4:18am.
|
|
|
|
|
|
Hello thatraja,
thank you for the fast answer. This helps me a lot
I tried it and it perfectly works. Thank you.
I took this part
Dim FSO
Dim oFS
CONST F_ATTR_RONLY = 1
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oFS = FSO.GetFile("d:\test\o2\test.png")
IF oFS.Attributes AND F_ATTR_RONLY
THEN
ELSE
FSO.CopyFile "d:\test\o1\test.png", "d:\test\o2\"
END IF
and it totally works for my purpose.
|
|
|
|
|
i created an application that loops numbers from 2 textboxs ("Starting Sequence" and "Ending Sequence") and displays it into a datagridview, what i am looking for is a code that would pass the selected cell from the datagridview into the microsoft reports, or pass each row into 1 page of report (i.e. sequence 0001 will be in 1 microsoft report page upto the ending sequence to the last report page) can anyone help me?
|
|
|
|
|
Can someone please guide me through this?
In this program you will create a Windows Form application that will calculate and display the money made by a drive-in movie theater each night. The movie theater has two types of nights. A "Regular" night is where each person in a guest car has to buy a ticket, and each ticket costs $10. A "Car" night is a special promotion where there is one price per car of $15, no matter how many guests are in the car.
In addition to the cost of entry (either Regular or Car), the theater sells popcorn and candy but the price of the items depends on the type of night. On a Regular night popcorn costs $1.50 per box and on a special Car night popcorn costs $2.00 per box. On a Regular night candy cost $2.25 per candy box, while on a special Car night candy cost $3.00 per box.
On any night, the maximum number of cars allowed in is 500 and the maximum number of individual tickets is 3,000; the theater can produce 4,500 bags of popcorn each night and has 4,000 candy items.
Once the total sales are calculated, the program will display a summary message with the type of night, the total number of cars, the total ticket sales, the total popcorn sales, the total candy sales, and the total sales amount.
|
|
|
|
|
This is what I have so far... Am I on the right track?
Public Class frmSalesData
Dim intCars, intTickets, intPopcorn, intCandy As Integer
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
Me.txtNumCars.Clear()
Me.txtNumTickets.Clear()
Me.txtNumPopcorn.Clear()
Me.txtNumCandy.Clear()
Me.lblTotal.Text = Nothing
Me.txtNumCars.Focus()
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim strMessage As String
Dim dblNumCars, dblNumTickets, dblNumPopcorn, dblNumCandy As Double
Dim dblTotalSales As Double
If radRegular.Checked = True Then
Me.lblTotal.Text = "Tonight was a REGULAR night."
ElseIf radCar.Checked = True Then
Me.lblTotal.Text = "Tonight was a CAR night."
End If
Double.TryParse(Me.txtNumCars.Text, dblNumCars)
Double.TryParse(Me.txtNumTickets.Text, dblNumTickets)
Double.TryParse(Me.txtNumPopcorn.Text, dblNumPopcorn)
Double.TryParse(Me.txtNumCandy.Text, dblNumCandy)
dblTotalSales = dblNumTickets + dblNumPopcorn + dblNumCandy
strMessage = "The total number of cars present was: " & dblNumCars.ToString() & _
"The total number of tickets sold was: " & dblNumTickets.ToString() & _
"The total popcorn sales were: " & dblNumPopcorn.ToString("N2") & _
"The total candy sales were: " & dblNumCandy.ToString("N2")
Me.lblTotal.Text = strMessage
End Sub
End Class
|
|
|
|
|
Looks reasonable to me, and you didn't receive any harsh comments yet.
If it does what the assignment states (and compiles), then it's a go
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Good stuff.
To add elegance use a StringBuilder for your message.
Normally you would get ragged on for posting an assignment (and was roundly ignored), posting the solution got you the upvote
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
how to filter a particular data from database bu using two arguments????
|
|
|
|
|
Can you explain further? Can you site your code? Or even tell us what are those two arguments you'll use?
We don't have crystal balls, nor we cannot read constellations here.
Don't mind those people who say you're not HOT. At least you know you're COOL.
I'm not afraid of falling, I'm afraid of the sudden stop at the end of the fall! - Richard Andrew x64
|
|
|
|