|
I need to check to see if a random access file exists before I initialize it. Here is the scenario. I am writing a program that stores the location of the random access files that hold its records in a random access file. The main file will always be in the same location. the first time the program is run I need to initialize the file and insert a default location in the file.
Is there a way to check to see if the file has been initialized besides having the user do it with a message box?
|
|
|
|
|
Use the System.IO.File.Exists(path As String) method to check for the presence of a file at a particular location.
Paul Marfleet
|
|
|
|
|
Hi,
I'd like more information on successfully tracking when someone changed locations in the VB.NET Web Browser control.
How do I know when they've clicked on a link and have successfully changed location? Compare WebBrowser1.locationURL to the previous LocationURL?
I want to know how to get this done effectively. Any help would be appreciated.
There's no such thing as time!
|
|
|
|
|
I wrote a Data entry app in VB.net and connected it to a SQL server 2005 database that is on our LAN.
I was just informed that this app will have to be used offsite by multiple users at different locations around my state and it has to update a central data store.
It would take me way too long to duplicate this app in ASP.net (I am ASP illiterate and only have a week to do this.)
Is there a way I can get my fat client app to use my database, which sits on my local area network? My company does have a domain and we do have an IIS server but I'm clueless.
|
|
|
|
|
If you have a static IP, you could just open the port for the database on your network and point the apps to that IP address/port.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I'm writing a utility to write SQL in, so I wanted to add functionality to automatically set the text color of comments. My problem is that right now I am using this bit of code:
Dim matchStart As System.Text.RegularExpressions.MatchCollection<br />
matchStart = System.Text.RegularExpressions.Regex.Matches(rtxtMySQL.Text, "/*")
To get a list of all the locations in the richtextbox that a comment starts...but because i have the asterisk in my pattern to search for, it's returning every character. This same code works fine when I search for "--" as the start of a comment. Does anyone know what I need to do to be able to search for "/*"? I would appreciate any help.
|
|
|
|
|
I hate it when five minutes after posting you find the answer yourself. I just needed to use the escape character \ before the *.
|
|
|
|
|
Kschuler wrote: I hate it when five minutes after posting you find the answer yourself.
No worries, it happens
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I am running this piece of code on a Windows 2000 professional desktop, Windows XP SP2, and Vista.
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Me.Validate()
Using updateTransaction As New Transactions.TransactionScope
Try
Me.TblCarrierBindingSource.EndEdit()
Me.TblCarrierTableAdapter.Update(Me.GBPSlitDataSet.tblCarrier)
Me.TblCarrierContactsBindingSource.EndEdit()
Me.TblCarrierContactsTableAdapter.Update(Me.GBPSlitDataSet.tblCarrierContacts)
Me.TblCommentBindingSource.EndEdit()
Me.TblCommentTableAdapter.Update(Me.GBPSlitDataSet.tblComment)
Catch ex As Exception
MsgBox("ex " & ex.Message)
Me.GBPSlitDataSet.RejectChanges()
End Try
updateTransaction.Complete()
End Using
Me.reset()
End Sub
If works fine on XP and Vista but on the W2k machine I get the message
The transaction has already been committed implicitly or explicitly or aborted.
On the XP and Vista machines I had to change the Local DTC properties to select Network DTC Access, Allow inbound, Allow outbound
no authentication.
There doesn't seem to be a comparable setting in W2k. Am I out of luck trying to use transaction on a W2K machine or is there a way to do it ?
Thanks
|
|
|
|
|
|
That would be my guess too since I had to change some MSDTC settings on XP and Vista to get it to work.
Could the fact that the W2k PC in question is not on the same domain have something to do with it ?
|
|
|
|
|
More than likely. You'll have to read the links I posted.
|
|
|
|
|
Hi,
I am trying to build a VB.Net Application to logon to a web page, using Web Browser Comtrol.
Yes, I managed to get the web page loaded into the Web Browser Control. But I do not know how to
a. Find the first text box (which can accept data)
b. Pass on data - from a textbox in the form to that text box in web page
c. navigate to next control and so on.
There are combo's, check boxes, etc in the web page.
Can somebody please let me know how this can be achieved, and if there are any similar demos, that would be appreciated. Or is VB.Net itself a bad selection? I am new to all this.
Regards
Rajiv.
|
|
|
|
|
Rajiv2007 wrote: Or is VB.Net itself a bad selection? I am new to all this.
It's not the language that's the selection problem.
The WebBrowser control exposes the loaded document in its Document property as an HtmlDocument[^] object. You can use its methods and properties to find and manipulate the controls through that.
|
|
|
|
|
hi,
I'm using vb.net and I just want to ask about the do...loop until command.
I understand that this is used whenever we want to do a condition all over again until it is true.. But what if it comes out till the end as false? How will I put it into code..
in such way as:
Do <statement><br />
loop until <condition>
hope anyone can help me solve this out..
thanks..
ange
|
|
|
|
|
Abbhie wrote: But what if it comes out till the end as false? How will I put it into code..
something = False
|
|
|
|
|
I want to put another statement if the result of the looping is still false (after its process)
|
|
|
|
|
The do loop checks at the end of the run whether the condition is true. If it is true it terminates. If the condition is still false, it starts again at the "do". Maybe you want to add another condition like
do
...
loop until (condition1=true or condition2=true)
?
|
|
|
|
|
The Do While loop will run continuously until the condition is true. There is no alternate "end" of the loop. If that's a possibility, maybe you should be considering a different loop type, such as For/Next.
|
|
|
|
|
Thanks Dave..
I was thinking of that too as an alternative. But I just don't know what's that for and how to use it. i just saw it in the MSDN Support.
|
|
|
|
|
If you don't know what a For/Next loop is, you REALLY need to pick up a beginners book on VB.NET. A For/Next loop is one of those very basic concepts they teach on the second day of class in any course involving VB.
|
|
|
|
|
Im having issues using PrincipalPermission to authenticate a Windows Domain account. I need to be able to see if a user belongs to a domain group even if they are not the account currently logged into the workstation. Here is the scenario:
A set of users will belong to a group. It is called "group1" . I am attempting to run this code to check if they belong to this group. If so - let them continue. If not, then catch the error. Here is the problem. When I (myaccount) is logged into the machine it authenticates fine for me. It won't authenticate for someone who is a member of Group1 while I am logged into the machine. Even if the other user is a member of group1 and has Administrator rights such as "Otheraccount" does below. The workstation this is running on has the following in the Administrators group:
DOMAIN\myaccount
DOMAIN\otheraccount
DOMAIN\Group1 (myaccount and otheraccount are members of this group)
I am running this code:
'***********************************************************
Dim SecurityCheck As New PrincipalPermission("DOMAIN\"& strUserName, "DOMAIN\Group1")
Dim strError As String
Try
SecurityCheck.Demand()
Catch errormessage As System.Exception
strError = errormessage.Message
If strError = "Request for principal permission failed." Then
MsgBox("You are not a local administrator. You do not have rights to access this software. If you need access, please contact your manager.")
Me.Close
Exit sub
Else
msgbox(strError)
End If
'***********************************************************
Any suggestions? I have tried this as well with the same results:
Dim SecurityCheck As New PrincipalPermission("DOMAIN\"& strUserName, "Administrators")
|
|
|
|
|
Don't post the same question again. You already continued this on a previous thread. Have some patience. We all have real jobs to do and only answer questions here on a volunteer basis when time permits.
|
|
|
|
|
Hi, I have an application that reads data from a text file into a datatable in the format required for a table in an SQL SErver 2005 database.
My question is, having filled the table 'manually' in memory, how do I connect that table to the database and insert the information? Obviously I can do inserts for each row in the datatable, but there are around 30,000 rows so I am looking for a faster method as this can take some time.
I understand that the dataadapter requires the insert command etc but 1) how do I get the table into the adapter and 2) does it know that these are new records?
Any help would be very geatly appreciated.
David Loring
!! Keep Music Live !!
|
|
|
|
|
I wouldn't use a DataAdapter or DataTable . I'd just read the file and create the INSERT statements directly and push it through a SqlCommand object. You can put multiple commands into a SqlCommand object - It is just a string of SQL after all.
|
|
|
|