|
No clarity in your Question.., can u elaborate your Question more...
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
You'll have to explain what you want to do and which version of VB you're using. Cookies are only used in web applications, so you'd be asking this question in the ASP.NET forum.
|
|
|
|
|
Pre-requisite: You are running this code under IIS/ASP type web server. Important differences are italicised.
VB.Net version:
Response.Cookies("CookieMonster").Value = "Yum yum"
VBScript version:
Response.Cookies("CookieMonster").Value = "Yuck yuck"
|
|
|
|
|
I have text File, the contents of text file is only "asd" and in my next line "masy".
Now i want to read this text file by the ReadLine Method so,
Do While objReader.Peek() <> -1
TextLine = TextLine & objReader.ReadLine() & vbNewLine
Loop
The Above Code works fine but when i studied in google about this objReader.peek(),its going to check character by character if there is no character it will return -1.
But when i execute this ,for the first loop my objReader.Peek() will have ascii code of a and in next loop it will be ascii code of m.
I am confused about this concept objReader.Peek().
please Can u help me
|
|
|
|
|
Simple way to look at it.
Each file has a file pointer that points at the next character available for reading.
The Peek will look to see if there is another character in the file at the file pointer.
If there is not it returns -1.
So it enters the loop and reads a line from the file.
If the file only contains one line this put the file pointer at the end of the file.
The next Peek then looks and finds no characters at the position pointed too by file pointer so returns -1, and the loop is done.
The Peek does not track down the file character by character it just looks at where the file pointer is pointing at, and that gets moved every time you do a read.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
|
Hi,
for file I/O you don't need Peek() at all, just create a loop and test the ReadLine() result, see here[^].
And for small files, read all at once using File.ReadAllText() or File.ReadAllLines().
You would need Peek() pr some other blocking call if the data is streaming in slowly, say in networking; but not for files.
|
|
|
|
|
I'm trying to zip a folder in the .net framework 2 (Customer wants this, not me). How do you do this?
|
|
|
|
|
Preserving the conditions of GPL license, you might use SharpZipLib[^].
|
|
|
|
|
So I should add this to MS Visual studio and use the libraries?
|
|
|
|
|
Well, errr, depending on what you understand by "add this to MS Visual Studio". If you mean that you have to add a reference to this library in your project, the answer is yes, of course.
|
|
|
|
|
Thanks Erik... I'm new to visual studio. So I'm a lot right now
|
|
|
|
|
We have a GZipStream[^] class. You can make use of that to create zip files.
|
|
|
|
|
i want to increase the space between to record front the front end by passing value as a parameter like 1,2,3
that should increase line spacing by 1,2,3 lines
how can i achieve this plz help
|
|
|
|
|
Please do not post in multiple forums; see this message[^].
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi,
I'm changing the text of an application writtewn in vb.net using the user32.dll method "SetWindowText".
The text of the application changes but the textchanged event for the form doesn't fire off.
Is there anything I need to do after sending the "SetWindowText" to the recieving app to fire off the even or something within the app itself?
Thanks,
Chris
modified on Thursday, October 28, 2010 6:14 AM
|
|
|
|
|
Of course it doesn't fire. You completely bypassed the .NET code that would have fired the event had the text been changed through the Forms Text proprty settor when you sent the message directly to the windows message pump.
There is nothing you can do to force the target app to fire off it's TextChanged event when you used this method.
Short of extrodinary difficult effort (read: not worth the cost to develop), I don't see how you're going to pull this off.
|
|
|
|
|
You should use SendMessage function to send a WM_SETTEXT message instead. SetWindowText will not cause this message if the target window is not owned by the same process you are making the call, and if WM_SETTEXT is not sent, TextChanged event will not be fired.
Anyway, I think this question should be in Windows API forum.
|
|
|
|
|
Thanks for the hint.
I solved the problem like this:
Using the following declarations:
Public Declare Function apiFindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32
Public Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hwnd As IntPtr, ByVal lpString As String) As Boolean
Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As String) As IntPtr
Private Const WM_SETTEXT As Integer = &HC
I then search for another instance of the application and send the message with the relevant details if it finds one.
Dim window As IntPtr = apiFindWindowEx(Nothing, Me.Handle, "WindowsForms10.Window.8.app.0.378734a", "PDF Viewer")
If Not window = 0 Then
SendMessage(window, WM_SETTEXT, 0, Command())
Me.Close()
End If
Then in the application (it's the same app but I only want one open at a time) there is this piece of code that checks the messages when they're recieved:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
If m.Msg = WM_SETTEXT Then
If justopened = True Or Me.Text = "PDF Viewer" Or Me.Text = "File Browser" Then
Else
pdfrecieved(Me.Text) 'goes and does stuff
End If
End If
End Sub
Thanks for the help!
|
|
|
|
|
Hi,
How to map drive by checking domain name when user log on,such as when user log on domain 1 map network drive = X
and if user log on domain 2 map netwrork drive =Y
I have write a script it as below details,tt seemed didn't work.Plese help. Thanks in advance
Option Explicit
Dim objSystemInfo
Dim objWSHShell
Dim strLogonServer
Dim objNetwork
Dim strDriveLetter, strRemotePath
Set objWSHShell = Wscript.CreateObject("Wscript.Shell")
strLogonServer = objWSHShell.ExpandEnvironmentStrings("%LOGONSERVER%")
WScript.Echo "Server Name is :" & strLogonServer
Set objSystemInfo = CreateObject("ADSystemInfo")
WScript.Echo "Site Namen is: " & objSystemInfo.SiteName
strDriveLetter = "X:"
strRemotePath = "\\domainname\home\"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
WScript.Quit
|
|
|
|
|
I don't exactly what you're looking for because your code doesn't check which domain the user logged into. But, here's an example of where the det the domain name:
Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "Domain = " & WshNetwork.UserDomain
|
|
|
|
|
Thank Dave
How to check domain if i have multiple domain and map network drive. Thanks in advance.
|
|
|
|
|
Why don't you use a script in the 'NETLOGON' share of one of the DC's of the domain you're connecting to ?
|
|
|
|
|
Hi,
Because of user working on multiple domain. I can't specific drive for them. I think it should be check domain before map network drive. Plese suggest me. Thank you
|
|
|
|
|