|
Session("myTxt") = Dropdown1.Text ' to assign into session variable
myValue = CType(Session("myTxt"), String) 'to retrieve the session variable
Regards,
Arun Kumar.A
|
|
|
|
|
If we set the Postback property to the second page,
the button_click event will not be fired.Hence we cannot assign the
session variables .
I think I am right.
Regards,
Arun Kumar.A
|
|
|
|
|
Hi Everyone.
I need to get the top position of a control relative to the form, regardless of which panel it is docked or placed on.
I am finding that the top attribute of a control (in this case a tree view control) returns top values relative to its panel.
Anyone know any magic to fix this?
fall down 6 times stand up 7
|
|
|
|
|
shubumpkin wrote: am finding that the top attribute of a control (in this case a tree view control) returns top values relative to its panel.
The Location (Left, Top) is alway s relative to the controls parent container.
To get to the form, you have to follow the Parent property of your control to it's parent contain, and keep following it up until Parent returns nothing. When you find that, your code is looking at the Form. A quick and dirty method to do this would be something like:
Public Shared Function GetTopContainerOfControl(ByRef childControl As Control) As Control
Dim currentControl As Control = c
While (currentControl.Parent IsNot Nothing)
currentControl = currentControl.Parent
End While
Return currentControl
End Function
This quick example doesn't have any error handling and CAN go on forever if there is a mistake in the control parent/child chain as an infinite loop will result. Since this doesn't use recursion, there is no danger of overflowing the stack, not matter how many levels deep a control is.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hello everyone !
I built a DLL file using VB.NET 2005.
How can I run its functions/subs with Windows RunDll32.exe command ?
Another question:
How do I retrieve function result if I call it with rundll32.exe ?
<br />
For example:<br />
Rundll32.exe c:\MyDll.dll ,FuncName<br />
Thank you very much,
And have a nice weekend !
Reuven
|
|
|
|
|
|
I tried to follow that article, and I still can't run my dll from Rundll32.
My code (VB.NET):
-----------------
Public Class Class2
<ExportDllAttribute.ExportDll("MSG", Runtime.InteropServices.CallingConvention.Cdecl)> _
Public Sub MSG()
MsgBox("Hello world !!!")
End Sub
End Class
After I compiled the dll into c:\SampleDll.dll I use the command line:
ExportDll c:\SampleDll.dll
(Release mode)
The result was: "Debug: False" in command line.
After that I tried to run my dll in this way:
RunDll32.exe c:\SampleDll.dll ,MSG
The result is system message box saying: "error in c:\sampledll.dll Missing value: MSG"
What am I missing,
Plz. help me.
Thanks,
Reuven
|
|
|
|
|
Hello,
I'm looking for a ZModem-Code in VB.
//Thomas
|
|
|
|
|
Hi,
I have to Get the Table values from sql server 2005 and display it in a DataGrid View in VB.NET 2005 Now I want to Add new record and Edit the values of existing one.
How to do it? Give me sample code..
Thanks in Advance
|
|
|
|
|
hi...I'm working on a clipboard project and i'm stuck at getting the full path and file name of a file that user selects to copy...user selects the file from anyfolder he wants and it can also be a folder... no OpenFileDialogBox used here...thnx
|
|
|
|
|
Dear All,
I am facing problem while reading from csv file. It is containing near around 5000 rows. My code is as follows:
Dim Tsream As TextStream
Dim AllRows() As String
Dim SingleLine() As String
Dim AllColumn() As String
Dim readcontents As String
'Reading data in text stream
Set Tstream = FSO.OpenTextFile(filetoread, ForReading, False)
readcontents = Tstream.ReadAll
'separating data of csv file as rows and storing all rows in an array
AllRows = Split(readcontents, vbCrLf)
'Reading data
For i = 0 To UBound(AllRows) - 1
'separating data as single row and storing columns in an array
AllColumn = Split(AllRows(i), ",")
a=AllCoumn(0)
b=AllCoumn(1)
. ..........
Z=AllCoumn(25)
next
But I am not getting correct value of UBound(AllRows).What may be the reason behind this? Is it due to the fact that many of the coulmns are empty in a row? When I save those csv files as text files and then try to read from the same code, everything works fine till the no. of rows are less than 1000 or so. Please tell me how to resolve this issue.
Thanks and Regards,
Virendra
|
|
|
|
|
Hi,
Check this out.
Private Sub cmdGo_Click()
Dim file_name As String
Dim fnum As Integer
Dim whole_file As String
Dim lines As Variant
Dim num_rows As Long
Dim the_array() As Variant
Dim R As Long
Dim C As Long
file_name = App.Path
If Right$(file_name, 1) <> "\" Then file_name = _
file_name & "\"
file_name = file_name & "test.csv"
' Load the file.
fnum = FreeFile
Open file_name For Input As fnum
whole_file = Input$(LOF(fnum), #fnum)
Close fnum
' Break the file into lines.
lines = Split(whole_file, vbCrLf)
' Dimension the array.
num_rows = UBound(lines)
ReDim the_array(num_rows)
' Copy the data into the array.
For R = 0 To num_rows
the_array(R) = Split(lines(R), ",")
Next R
' Prove we have the data loaded.
For R = 0 To UBound(the_array)
For C = 0 To UBound(the_array(R))
Debug.Print the_array(R)(C) & "|";
Next C
Debug.Print
Next R
Debug.Print "======="
End Sub
Regards,
Manowj
|
|
|
|
|
Hi! Manowj
Thanx for your kind co.operation. But this code is giving error while reading from CSV file. The error is
"Input past end of file" in the following section
' Load the file.
fnum = FreeFile
Open file_name For Input As fnum
whole_file = Input$(LOF(fnum), #fnum)
Close fnum
Though code is going fine with text files.
Thanks and Regards,
Virendra
|
|
|
|
|
Hi! Manowj
Thanx for your kind co.operation. But this code is giving error while reading from CSV file. The error is
"Input past end of file" in the following section
' Load the file.
fnum = FreeFile
Open file_name For Input As fnum
whole_file = Input$(LOF(fnum), #fnum)
Close fnum
Though code is going fine with text files.
Thanks and Regards,
Virendra
|
|
|
|
|
Hi All,
I want to generate a Data Report from VB6.0 without Database(MSACCESS, Oracle etc..).
I want to read the data from .txt file and to generate a Data Report in VB6.0.
Please Guide me..
-- modified at 0:48 Friday 27th April, 2007
Thanks & Regards
Kumaran
|
|
|
|
|
Hello All!
I am really stumped on this. So I have a server/client app, with SQL as a backend. The client program has it's forms come up by the server. That where I use the FileWatch process. Works pretty well, and fast. I creat a file from the server on server, the client flewatch see that file, and open up a form. A timer on the form closes after a few some time. The file the server creates, gets deleted. I'm sure this isn't the best way, but it works pretty well, except now. I can only run up to like six or seven at a time. Anyone of them will work, but not all at the same time. My server is created the files just fine, so the problem is with the client side. I don't get a warning or an error. The watch process just doesn't run.
So here is a sample of the code.
Declaring it, Public FggWatch As New FileSystemWatcher
I have this in my form load event. I also tried to put it in IntilizedComponet.
AddHandler FggWatch.Created, AddressOf FggWatch_Created<br />
FggWatch.Path = (TempFileSetting)<br />
FggWatch.Filter = "*.fgg"<br />
FggWatch.IncludeSubdirectories = False<br />
FggWatch.EnableRaisingEvents = True<br />
And then here is what happen after the file gets tagged
Private Sub FggWatch_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)<br />
Dim frmFgg As New frmFggWn<br />
Sound.PlayWaveResource("ding.wav")<br />
frmFgg.ShowDialog()<br />
End Sub
It worked fine for weeks, then all of sudden! You know. Now keep in mind I have 13 of thees little gems, the only difrence in the file names, and a diffrent form get displayed.
Thanks!!
Rudy
|
|
|
|
|
Rudy I am a little vague on what you are trying to do but the filewatcher can become unstable over time. So first off do you run the application that is hosting the filewatcher as a windows application or as a service? Why are you running so many filewatchers?
|
|
|
|
|
Hi Kevin!
It's running as a windows application. Basicly I need the server to control the client software 90% of the time, at will. For example, when a button on the server is pressed, form 1 opens on the client. When button 2 on the server is pressed, a timer starts on the client. The user at the client has very little control.
I have tried .Net Remoting, but havent been very successful at it. I thought about creating events that stop and start the filewatches at certain times. Just haven't gone down that road yet.
Why would a filewatcher become unstable over time?
Thanks!
Rudy
|
|
|
|
|
Most of my experience with FileWatchers is in the services realm I just don't use them that much in windows applications so there may be differences. To be precise I believe the Filewatchers become unstable because of the code they are running in. The threading in the Filewatcher can cause other contention issues in the application particularly when you are running timers also.
I periodically recycle the services and this seems to solve the issue but that is not good design. I am more prone to running them inside of their own class now and tearing that down and re instantiating it periodically disposing of all resources. I also try to use as few filewatchers as possible and change where they are pointing in code so I have fewer moving parts to keep track of.
So far it has been pretty stable but this is in windows services not windows applications which should not be an issue but they are much less complicated. What I have done is 180 degrees from what you are doing so there are clear differences. I use logging quite a bit to track down issues with timers and filewatchers as well as the performance monitoring tools which has been helpful.
|
|
|
|
|
Thanks for the tips Kevin!!
Rudy
|
|
|
|
|
i convert a project of C# to Vb.net, then in vb.net one warning messege appear in following line
Imports System.Management
warning is:::
Warning 1 Namespace or type specified in the Imports 'System.Management' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
as well as some of its component giving error ,like
ManagementObjectSearcher
Error 2 Type 'ManagementObjectSearcher' is not defined. <br />
etc...
someone know the cause\solution....????
|
|
|
|
|
You must add a reference to the System.Management namespace in VB.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
hey nice, its working, i got new thing today
|
|
|
|
|
Hello there,
sorry this is my first post.
I really urgently need someones help. Ive got this question for some work and I have no idea how to do it. The teacher hasn't shown us and I cant find anything to help me on the net. I need to complete this question as not doing it will mean I fail my course. PLease could somebody help me out. I Would be so appreciative!!
Here is the question -
This problem concerns some simple array handling.
Problem specification
Given an array of integers, you have to perform some integer calculations, and display some information concerning their number, their sum and average values, their minimum and maximum values, and the number of even and odd integers.
Method
Create an empty integer array that will hold up to 20 integers. Then, repeatedly read integer values from the keyboard until the user types zero. Afterwards, loop through the array and display the number of integers read (excluding the terminating zero), their sum (an integer), their average (a double), the minimum and maximum values encountered
(both integers), and finally the number of even and odd integers read (these should be declared as integers too).
Always exclude the terminating zero from your calculations.
Error conditions: If you encounter a negative number (e.g. -151), display the message
Negative number: -151
Don't take it into account in your calculations.
If you encounter a number greater than 100 (e.g. 199), display the message Value exceeds 100: 199 and exit immediately.
If there are no valid numbers in the array to process, display the message No numbers to process! and exit immediately.
To me it is really complicated and I have no idea where to start! Im completely stumped on how to do the calculations and incorporate them into the array! I have had a try and ive managed to build the array, but, it is rubbish and doesn't work very well.
I know this is asking a lot of someone but I really have no idea what to do. I've tried google and everything, searched the help files etc.
Please, please, please help.
John
|
|
|
|
|
new_rez wrote: The teacher hasn't shown us
This means one of three things.
1 - the teacher HAS shown you
2 - the teacher expects you to be able to find the info online or in your texts
3 - you have a bad teacher
I recommend asking some fellow students, if they agree on 3, complain to the school.
new_rez wrote: To me it is really complicated and I have no idea where to start!
I'm afraid that it's sufficiently trivial that I really don't see how I can offer any help without doing it all. I also am certain that the web abounds with information on how to create arrays, on how to read input from the keyboard, and on how to iterate over an array.
new_rez wrote: Im completely stumped on how to do the calculations and incorporate them into the array!
You don't incorperate anything in the array, you step over the array and you render the calculations to the screen.
new_rez wrote: I have had a try and ive managed to build the array, but, it is rubbish and doesn't work very well.
We love to help people, but we don't like doing people's homework verbatim. How about if you post your code, define 'doesn't work very well', and we can offer some help from there ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|