|
Unless your ToString method contains complex logic and formatting rules, you could specify it directly in the attribute as <DebuggerDisplay("ProperyOne = {PropertyOne}, PropertyTwo = {PropertyTwo}")> . Also, try specifying it like this: <DebuggerDisplay("{ToString()}")> .
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
You will want to look into adding custom AutoExpand rules. A search for AutoExp.dat should get you the info you need.
Note: On my system, AutoExp.data is located here:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Packages\Debugger
|
|
|
|
|
Hello guys!
I´m using the Dir$() function, that returns the paths of the files that I want.
I noticed that the sequence is always the same. I need a reverse function just like a navigation through image files, backward and foward. Does anyone have an idea?
Thanks!
|
|
|
|
|
No, there is no "sorting" like that going on. The order of files you get is not guaranteed, but tends to follow the order as they come from NTFS.
There is no function that will return them in backwards order. Get the list of files from NTFS, including the creation date/time and sort the list on that.
|
|
|
|
|
Hi,
I know that you can use extension methods in C# while targeting version 2.0 of the .NET framework by creating your own System.Runtime.CompilerServices.ExtensionAttribute
I've done the same in a VB.NET application but for the life of me I can't get the thing to work. Here is the code I'm using:
Namespace System.Runtime.CompilerServices
<attributeusage(attributetargets.method> _
Public NotInheritable Class ExtensionAttribute
Inherits Attribute
End Class
End Namespace
In a module
Imports System.Runtime.CompilerServices
<extension()> _
Module ExtensionMethods
<extension()> _
Public Function Test(ByVal s As String) As String
Return s & " hello"
End Function
End Module
Sub Main()
Dim s As String = "Hello"
Debug.Print(s.Test())
End Sub
I get a compiler error saying that "Test is not a member of String"
Am I missing something or can you simply not use extension methods in VB.NET for version 2.0?
Thanks very much,
dlarkin77
|
|
|
|
|
If I remember correctly, extension methods cannot be targeted for version 2 (for example extension attribute was introduced in 3.5). Have a look at this article: Extension Methods (Visual Basic)[^].
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
It seems I was being particularly dense yesterday afternoon. The reason I couldn't get this to work was that I was actually using VS 2005 instead of VS 2008.
The above code snippets work correctly when targeting .NET 2.0 in a VS 2008 project
Thanks,
dlarkin77
|
|
|
|
|
Does anyone know how to get it put into a web page i made it it works when i run it using VB6.0 it opens an IE windows and performs exactly as desired its a standalone so its not that hard i just dont know how to put it on the web for people to use any information would be great a link to anothe rsite on activeX components
the program is simple only a couple lines of code does not need to connect ao server of any kind just need help getting it onto a web page thank you for your time
|
|
|
|
|
I think you want to look into the OBJECT tag. Here...[^]
|
|
|
|
|
Hi,
I don't know if it is a good practice what I am doing here.
I have a class that is making the connections to the database. The connection string I save in the web.config.
And this is the property that I used inside that class to get the connectionstring.
Does it make sense?
''' <summary>
''' This variable holds the db connection string.
''' The value of the db connection string is saved in the web.config.
''' </summary>
Private Shared sConString As String = System.Configuration.ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
Private Shared ReadOnly Property ConString() As String
Get
Return sConString
End Get
End Property
|
|
|
|
|
Making the property private is pointless as the only thing that access to the property also has access to the original string. Other than that, looks okay.
|
|
|
|
|
So, it is better that I use only
Private Shared sConString As String = System.Configuration.ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
Isn't that so that every time I ask for sConString, he will lookup the connection string in the web.config?
Or I can do the following ?
Private Shared sConString As String = ""
Public Sub New()
sConString = System.Configuration.ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
End Sub
|
|
|
|
|
ESTAN wrote: Isn't that so that every time I ask for sConString, he will lookup the connection string in the web.config?
No. It won't. Think about what you are actually doing. You have a shared field on the class. It has no functionality, it is just a reference to an area of memory that stored the connection string.
ESTAN wrote: Or I can do the following ?
Private Shared sConString As String = ""
Public Sub New()
sConString = System.Configuration.ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
End Sub
You can, but I don't see the point.
|
|
|
|
|
Thanks, than I will keep only the 'reference' to this object.
Private Shared sConString As String = System.Configuration.ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
|
|
|
|
|
They both accomplish the same thing. If you have multiple constructors, then you have to reduplicate the "sConString = System.Configuration.ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString" line for each constructor.
I prefer 'Private Shared sConString As String = System.Configuration.ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString' because I am lazy.
Cheers!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I am trying to schedule a program I wrote to run after hours when I am not actually logged onto my machinge. The code works fine while I am testing it, but it doesn't run when I schedule it. It appears to be an issue with the focus of the windows, but I am not sure how to correct it. I think sendmessage() might work, but not sure how to convert my send.keys code to send message. Can anyone show me how to conver the follwoing code so that it will run even if I am not logged on to the PC?
CODE:
Imports Microsoft.VisualBasic.Devices
Module Module1
Sub Main()
Dim ProcID As Integer ' Start the EXTRA
Dim counter As Integer = 0
Dim check As Boolean = True
ProcID = Shell("EXTRA.exe", AppWinStyle.NormalFocus) ' Activate the Calculator application.
AppActivate(ProcID)
My.Computer.Keyboard.SendKeys("WFA_DO_CP.edp{Enter}", True)
System.Threading.Thread.Sleep(5000)
My.Computer.Keyboard.SendKeys("na50{Enter}", True)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("loadbal1loadbal1{Enter}", True)
System.Threading.Thread.Sleep(2000)
My.Computer.Keyboard.SendKeys("/for vgs1sign{enter}", True)
System.Threading.Thread.Sleep(2000)
My.Computer.Keyboard.SendKeys("loadbal1loadbal1{Enter}", True)
System.Threading.Thread.Sleep(1000)
Do
Do While counter < 10
counter += 1
If counter = 1 Then
AppActivate(ProcID)
My.Computer.Keyboard.SendKeys("{home}goqsre{enter}", True)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("{tab}132_dd{tab}vggdtldd{tab 2}ctr_supv", True)
My.Computer.Keyboard.SendKeys("%(T){enter}", True)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("OQS to Excel 2000{tab}{enter}", True)
System.Threading.Thread.Sleep(360000)
ElseIf counter = 2 Then
AppActivate(ProcID)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("/for goqsre{enter}", True)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("{tab}731_dd{tab}vggdtldd{tab 2}ctr_supv", True)
My.Computer.Keyboard.SendKeys("%(T){enter}", True)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("OQS to Excel 2000{tab}{enter}", True)
System.Threading.Thread.Sleep(360000)
ElseIf counter = 3 Then
AppActivate(ProcID)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("/for goqsre{enter}", True)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("{tab}132_ptd{tab}vggd1xdd{tab 2}ctr_supv", True)
My.Computer.Keyboard.SendKeys("%(T){enter}", True)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("OQS to Excel 2000{tab}{enter}", True)
System.Threading.Thread.Sleep(360000)
ElseIf counter = 4 Then
AppActivate(ProcID)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("/for goqsre{enter}", True)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("{tab}731_ptd{tab}vggd1xdd{tab 2}ctr_supv", True)
My.Computer.Keyboard.SendKeys("%(T){enter}", True)
System.Threading.Thread.Sleep(1000)
My.Computer.Keyboard.SendKeys("OQS to Excel 2000{tab}{enter}", True)
System.Threading.Thread.Sleep(360000)
check = False
Exit Do
End If
Loop
Loop Until check = False
End Sub
End Module
|
|
|
|
|
I don't want to be the one to aske the obvious question - but I'm going to.
Why are you not using the Windows Task Scheduler?
|
|
|
|
|
I am using windows task scheduler. However it will not run the program properly becasue it does not seem to maintain focus on the proper window. From reading so posts online if doesn't seem the the sendkeys function works when you pc is "locked." I understand that but not sure how to covert the sendkeys function to something that will worked even if the PC is locked.
|
|
|
|
|
Okay - The next question: Why does an application that is lauched from the task scheduler have a user interface? If you have a user interface for configuration then set up a command line argument that the Task Sdheduler uses to suppress the user interface.
|
|
|
|
|
Ditto. Start the app without an interface using the command line args to drive the operations you need to perform.
my.Application.CommandLineArgs
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
What the program does is launch an application, then logs-in and runs 4 reports. The problem I have is that I used the sendkeys to log in and run the reports, but from my understand this function does work if I am not logged into the PC (a focus issue). So I am trying to see how to convert sendkeys to something that will work even if I am not logged in.
|
|
|
|
|
farmer wrote: What the program does is launch an application, then logs-in and runs 4 reports. The problem I have is that I used the sendkeys to log in and run the reports, but from my understand this function does work if I am not logged into the PC (a focus issue). So I am trying to see how to convert sendkeys to something that will work even if I am not logged in.
Then start your app like such through task scheduler: "c:\program files\AutoApp.exe" -admin -r1 -r2 -r3 -r4
Inside the app during the constructor or form load, you need to check to see if there are command line args. If there are, you need to loop collection of startup arguments and process the input as required. If -Admin is present, log in as your account. Run each report as specified (like -r1, -r2, etc).
Once your batch processing is completed, kill the app and the form is never displayed. SendKeys is not necessary nor should it be used for this type of functionality.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
as others have said, using command line arguments would be much easier. make the user name and passwords part of the command line argument and then there is no need for a user interface.
|
|
|
|
|
farmer wrote: from my understand this function does work if I am not logged into the PC (a focus issue).
No, it's not a focus issue. The issue is that you are trying to use the user interface to interact with another application, but there is no user interface at all. You can't set focus to a window when there are no windows.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi all,
I have one textbox,called Name which is validated for not blank.
Error msg: txtbox not blank.
if click the submit button,the validation applies and eerrror msg. displays --txtbox not blank.
and the cursor is out from the textbox.
my problem is ,after i got the error msg. the cursor will be placed in the textbox name.
i am using
txtname.Focus() but still it is not working.
If txtname.Text.Trim.Equals("") Then
lblError.Text = "Please enter Name."
lblError.Visible = True
txtname.Focus()
Exit Sub
End If
Thanks in advacce
mahaboobs
|
|
|
|