|
pls how can i serched a prtivious question. but pls will this code enable me to read all line in a file being read by another process
Dim fs As New FileStream("ftpLogDirectory", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
s = File.ReadAllLines(ftpLogDirectory)
thanks
|
|
|
|
|
Ebube wrote: pls how can i serched a prtivious question
try the search box at the top of the screen
Ebube wrote: will this code enable me to read all line in a file being read by another process
Dim fs As New FileStream("ftpLogDirectory", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
s = File.ReadAllLines(ftpLogDirectory)
Probably. Why not try it and see?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i put the this code within try catch block and it is giving me objecte refrence not set to an instance of an object exception . can someone help
Dim fs As New FileStream(ftpLogDirectory, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim ds As New StreamReader(fs)
Dim line, le As String
line = ds.ReadLine
While line <> ""
Me.ListBox3.Items.Add(line)
line = ds.ReadLine
le = Mid$(line, 1, 1)
If le <> "#" Then
Dim ns As String = line
Dim RFpath, RFName, RFolderName, FullPath As String
'If InStr(ns.ToLower, "sent") > 0 Then Me.ListBox2.Items.Add(ns)
If InStr(ns.ToLower, "sent") > 0 Then
RFpath = ns.Substring(InStr(ns.ToLower, "sent") + 4)
RFName = RFpath.Substring(InStrRev(RFpath, "/"))
RFName = Replace(RFName, "+", " ")
RFolderName = RFpath.Substring(1)
FullPath = "/" & RFolderName
If InStr(RFolderName, "/") > 1 Then
RFolderName = RFolderName.Substring(0, InStr(RFolderName, "/") - 1)
End If
Dim newns As String = ns.Substring(0, InStr(ns, "[") - 2)
IpAddress = newns.Substring(0, InStrRev(newns, " ") - 1)
IpAddress = IpAddress.Substring(InStr(newns, " "))
newns = newns.Substring(InStrRev(newns, " "))
If Not InStr(newns, ".") > 0 Then
ReciepientName = newns
End If
If InStr(FullPath, dPath) > 0 Then Return True
' Return True
'Else
' Return False
End If
'
End If
End While
|
|
|
|
|
1. At which line? that shoud give you a clue
2. Try writing .net code, not vb6/vba code, you will have less errors
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I have a datagridview and am adding several rows through code. I have a combobox that is databound to a datatable for the items to select. So far everything works great except that I cannot set the selectedvalue of the combobox for the current row I am adding. Can anyone offer any suggestions, please?
Thank you, Chester
|
|
|
|
|
What are you populating the combobox with? If it is just a string then try selectedText or selectedItem.
|
|
|
|
|
The selectedvalue is an integer and the displaymemeber is a strig. I want to set the selected value to the integer value and then have the combox display the string that goes with that integer value.
|
|
|
|
|
Ah. I had a similar problem. What I was doing wrong was binding the combobox to the datasource and then setting the display and value members when in fact it should be done the other way around.
So it should be:
cboCombo.ValueMember = intValueMember
cboCombo.DisplayMember = strDisplayMember
cboCombo.DataSource = dsDataSource
Maybe you are doing the same thing?
|
|
|
|
|
Yes the databinding works correctly because the combobox is filled, but what I want to happen is when I load the data from the datatable, I want the combo box to prefill with the correct text based on the selected value...
Thank you....
|
|
|
|
|
I'm also facing the same problem. Any help will be appreciated.
|
|
|
|
|
|
i am working on C# code. i was faced same problem.
but i solve this by set combox value.
here carefull that combox valumember data type and your given value data type is same.
Thats the main point of datatype problem.
Thanks
Tonmoy
|
|
|
|
|
I am doing work on graphics using vb .net 2005. I have a bezier (4 points) curve. a line intersects bezier curve. i want to draw two beziers from where line has intersect. if any body help me
|
|
|
|
|
Please help me with this CODE. What I want to do is to update the existing data in my database.
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlDataReader
Imports System.Transactions
Imports System.Collections
Imports System.Collections.Generic
Public Class SelectStaffManager
Const strConnectionString As String = "Server=(local);Initial Catalog=VideoClub;User ID=sa;Password="
#Region "SQL Statements"
Private Const SQL_SELECT_STAFF As String = "Select * From Staff"
Public Shared Function SELECTStaff(ByVal FirstName As String, ByVal LastName As String, ByVal ContactAddress As String, ByVal MaritalStatus As String, _
ByVal Sex As String, ByVal EmailAddress As String, ByVal DateofBirth As Date, ByVal DateofEmployment As Date, _
ByVal Photograph As String, ByVal PhoneNo As String, ByRef strMessage As String) As Integer
Dim SqlConn As SqlConnection = Nothing
Dim cmd As SqlCommand = Nothing
Dim SqlParm As SqlParameter = Nothing
Dim collectdata As SqlDataReader
Try
'Prepare the SqlCommand Object and all it's neccessary properties for data commission into the database
SqlConn = New SqlConnection(strConnectionString)
cmd = New SqlCommand(SQL_SELECT_STAFF, SqlConn)
'cmd.Connection.Open()
collectdata = cmd.ExecuteReader
cmd.Connection.Close()
Catch ex As Exception
collectdata = Nothing
strMessage = ex.Message
End Try
Return collectdata
End Function
#End Region
End Class
|
|
|
|
|
So what is your question ? Do you receive an error ?
|
|
|
|
|
Your code, as far as I can see, does nothing other than open a datareader and close the connection. What are you trying to do? (please don't say "update my database", it's the most useless answer you can give)
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hello every one,
I have a public function in a existing application which is called from many different forms. The form name is also passed but as a string to his function.
What i wanted to do is close the form from which it is called depending on certain conditions
how i can do that
button_click
{
call test("frm1")
}
Public function test(byval formName as string)
{
'condition
'close the form which called this function
'I want to some how execure frm1.close()
}
|
|
|
|
|
First you need to store the collection of open forms so that you can find them again, a List or Collection. A manager class to handle adding and removing/closing would be preferred to handle the List/Collection.
In the function, look for the form with the name, and ask the manager class to close the form.
If a form is closed via UI, inform the manager class to remove itself from the List/Collection.
You will need to handle situation where multiple form of the same type has been opened.
|
|
|
|
|
I need help urgently for this question. Can someone help me on it.
|
|
|
|
|
Since you want to do this in VB.NET instead of C# I assume you already have the code in C#. Simply translate it to VB.NET (Search for a converting tool C# -> VB.NET on google).
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
pls i have a project that i want to read a file from C:\WINDOWS\system32\Logfiles\MSFTPSVCg but it show error that another process is reading the file. this app uses ftp. i suggest the problem is the ftp reading the file. how can i overcome this and read the file
|
|
|
|
|
you should be able to share the file without problems
try something like:
dim fs as new system.io.filestream("yourfilenamehere", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
The part at the end of your filestream method (FileShare.ReadWrite) tells your filestream that it can share the file with other proccesses.
|
|
|
|
|
can i use sometime like
s = file.readalllines(path) after your statement to read all the line. if no how can i read all line thank
|
|
|
|
|
Hmm.. i suggest you do a little looking up on google before you continue cause looking at your pseudo code.. you are not really catching on... Depending on what you want.. you could do the following to read the entire file:
dim sMyVariableThatWillContainTheWholeEntireTextOfTheFile as string
dim fs as new system.io.filestream("yourfilenamehere", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
dim sReader as new streamreader(fs)
sMyVariableThatWillContainTheWholeEntireTextOfTheFile = sReader.ReadToEnd
However.. take under consideration that depending on the size of the file, this might not be the best way to go.. you could also do :
sReader.ReadLine()
to read the file line by line and perform actions on the content of that line..
Take a look at the streamreader class here: http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx[^]
|
|
|
|
|
if u have permission to access the file,
just copy it to a specific place then read the copy !
" I love deadlines. I like the whooshing sound they make as they fly by. "
|
|
|
|