Powershell - Return Custom Object To C# Host?
Apr 26, 2011
I have the following powershell script which loads a custom .NET DLL this contains the ScriptResult class, it is intern executed from a VB.NET app.
Add-Type -Path $myLibPath
$result = New-Object TheLibrary.ScriptResult
[code].....
View 2 Replies
ADVERTISEMENT
Aug 15, 2011
I wonder if it is possible to write and capture errors when running a script to PowerShell.In my case I am using the following code:[code]' add an extra command to transform the script output objects into nicely formatted strings' remove this line to get the actual objects that the script returns, for example, see the script "Get-Process" returns a collection.[code]
View 4 Replies
Aug 3, 2009
I need to get the host out of the Request object. Which property should I use and why?
From MSDN:Uri.DnsSafeHost Property A String that contains the unescaped host part of the URI that is suitable for DNS resolution; or the original unescaped host string, if it is already suitable for resolution.
vs
Uri.Host Property A String that contains the host name. This is usually the DNS host name or IP address of the server.
My testing has been with the ASP.NET Development Server. Both of these always return localhost. Even when I put in 127.0.0.1, both return localhost.Reading on, the DnsSafeHost property will handle IPv6 addresses, as well as Unicode to ASCII conversion if needed. It can also account for IRI and IDN. Even though I currently don't care about these things, should I just use the DnsSafeHost property to be safe?
View 1 Replies
Oct 7, 2010
I'm working up a system where I plan on using RealProxy objects to enable intercepting method calls against a set of objects, handling the call, and then returning appropriate results. This works just find for simple return types like strings or ints, but I can't seem to return objects from the RealProxy.Invoke method. Everything works. I get no errors, but the returned value is always NOTHING, instead of an object.
I've worked up the smallest sample code I could, and have included it below. Essentially, just call RPtest and single step through. The code creates a simple object, RPTestA, with a string field and an object valued field It then retrieves the string
[Code]...
View 1 Replies
May 10, 2011
I have an application that creates desktop shortcuts. To do this I have to reference the Windows Script Host Object Model. When I add it as a reference, it always creates the DLL, Interop.IWshRuntimeLibrary.dll, in the objx86Debug directory, then references itself to it, rather than looking at wshom.ocx. Even if I add reference wshom.ocx it reverts to saving the file in the objx86Debug directory. The problem is if I move my application to another computer without that DLL being present, the program fails to run.
View 1 Replies
Mar 4, 2009
I have an interface that describes an specialized list in my application...
[Code]....
Is there a way to make an interface serializable, or am I going to have to convert each of my objects into a concrete class implementing the interface, and then return that class?
View 2 Replies
Feb 10, 2012
I have created a custom user control (JCUserControl), and I am using it in the Main Window. And my Main Window has no codebehind. I have this in the JCUserControl codebehind:
Private Sub ImmediateRadioButton_Checked(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles ImmediateRadioButton.Checked
SomeTextBox.IsEnabled = False
End Sub
When I run it, it fails with the NullReferenceException. If I comment out the SomeTextBox.IsEnabled = false, it runs without any problems.
Edit: Found out that I could just check if the radio buttons are loaded before doing whatever I want to do.
Private Sub ImmediateRadioButton_Checked(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles ImmediateRadioButton.Checked
If ImmediateRadioButton.IsLoaded Then
SomeTextBox.IsEnabled = False
End If
End Sub
View 1 Replies
Dec 1, 2010
We have a huge windows application with poor exception handling. The application throw object reference error from lot of places and the system error message is showing to users as it is using message boxes.
I am looking for a simple solution which can be used to replace this message to something user friendly for the entire application
View 5 Replies
Apr 5, 2012
I have a JSON object that looks like this.
{
"Errors":{
"err1":[
//* Array of err1 objects
[code]....
PD: I'm currently using Newtonsoft's JSON.Net library.
Public Sub New(ByVal jsonText As String)
Dim jObject As JObject = jObject.Parse(jsonText )
Dim jErrors As JToken = jObject("Errors")
Dim jS = New JsonSerializer()
[code]....
View 3 Replies
Dec 27, 2011
I have a custom EditButton that shows a dialog for the user to select a value.This is used by an xtra grid as an editor for a cell.The user can click the cell editor, the dialog shows and they can select the item they want.
View 1 Replies
Jun 8, 2011
I have a custom class named Location with multiple properties.
[Code]....
How can I get the value of each p.Name and return "Main St", "AnyTown" o "USA"
View 1 Replies
Oct 21, 2010
I am building my own Message Box, I have overloaded the ShowDialog function and i wish to Change the Return Type from DialogResult to my own.
View 3 Replies
Apr 7, 2009
i am creating my own message box. My msgbox contains 4 button , so i want to return an integer value as the button no. that was selected (i.e return 1 for button 1, 2 for btn 2...)i tried me.dialogresult=1 , but its not working
View 4 Replies
Mar 12, 2010
I'm making a class that reads a file and processes data in it, but I need some error handling. I'm giving it a constructor that takes a file location and processes that file. How can I make it so the constructor tells the program whether it found the file or not? Optimistically the program that calls this class would check for that first, but since I'm not going to be the only one that uses this class I'd like to know how to secure such a thing. It's probably bad practice to do this within the class, but I'd like to be sure it's as portable as possible.
View 6 Replies
Apr 29, 2010
I am building my own Message Box, I have overloaded the ShowDialog function and i wish to Change the Return Type from DialogResult to my own.To do so , shall i declare an Public Enum within the form and set it as the Return Type, or is there any other proper way?
View 2 Replies
Feb 11, 2011
So I have an application that uses a webservice, On the UI side the user picks a table which sends a request across the web to my webservice to return the fields of this table. So after this request is accomplished I have, on the webservice side a series of Name,Type Pairs that I need to serialize and send back to my client. I could use a List(of String()) to send the values back but I want to use a List(of Custom_Class) instead because later I have to do this on a much larger scale and I want to learn on this simpler version.
[Code]...
View 1 Replies
Sep 3, 2009
After reading all the examples for list of T exists and Find and find first, none show how to handle multi-property objects. Below is bare bones example maybe someone could flesh out to show how this should be done.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DatePriceList As New List(Of DateAndPrice)
DatePriceList.Add(New DateAndPrice(Date.Parse("1/1/2000"), 10.12))
DatePriceList.Add(New DateAndPrice(Date.Parse("1/2/2000"), 11.12))
[Code]...
View 3 Replies
Feb 17, 2011
I'm learning .NET and I've got a question about user controls. I'm using VS 2010.. I've created an user control, which contains a textbox (code), a button and a label. When you fill in the textbox, the system searches of the codes exists, if so, the description is showed in the label, else it's cleared. When you click the button, a form opens with a datagrid where you can select a code. When you select a code in the datagrid, the code textbox should be filled in with the selected code. How do you return the selected value to the custom control? I've created a public property in the custom control, but i can't access it.
View 1 Replies
Dec 1, 2010
I'm wondering whether its possible to have a function's return type and input arguments as a variable.
For example this function:Private Function MyFunction(ByVal argument1 As VariableType) As VariableType
[Code]...
View 6 Replies
Aug 17, 2011
I have a WCF service wich has this function:
[Code]...
wich returns the values specified here:
[Code]...
Each one of this functions returns a List of entities. If I call this functions individually they return their values ok. But what I want is to make only one call to the service and no several! I want to be able to receive it in another application like this:
[Code]...
View 1 Replies
Feb 3, 2012
I'm connecting my program to some external code. I'm setting it up so that the external code can instance objects and I've come across a problem. I've created this function here:
[Code]...
I'm trying to create a System.Diagnostics.Process object. For what ever reason though, it always return Nothing instead of the object. Does anybody know what I'm doing wrong? I'm doing this in VB.net so all .net responses are accepted :)
View 2 Replies
Apr 24, 2011
I am working on an app that searches my network and retrieves ips and host names, but when using this.[code]
View 2 Replies
Nov 14, 2010
I have a class i've called "buttons", which passes in 1 variable, the button text, and then returns a new button with that text. however, i do not know how to get the class, when called to return a button.
similar to how 'toString' works, except it would return a button object instead of a string. (im not sure how toString works in vb.net. in java it is automatically called when you call the new class, so newclass and newclass.toString(); return the same) [code]...
View 2 Replies
Feb 27, 2012
way to return an object.
For example.
Object Class with properties
Public class objProps
Property ORDERNUM() As String
[Code]....
View 12 Replies
Mar 13, 2011
I'm trying to return an object from a function. E.g. Ive got a function populateDog that returns Dog. So in my aspx class I want to be able to be able to pass in Lassie as the name of the dog(I have a dog class) and have the function return the object with the data it populated. [Code] The idea was to have a database and I would eventually pass in an ID to query results and return it.
View 1 Replies
Dec 10, 2009
I was wondering if there's a way I can make my objects return their own variable name as a string, something like this:
Public Class MyClass
Public ReadOnly Property VariableName() As String
Get
[Code]....
Is this possible? I'm fairly sure it should be possible through the System.Reflection namespace, but I can't figure it out.
View 7 Replies
Feb 12, 2011
I 'm new to programming and to vb. So my question could be from misconception about what can i do. How can i pass a string to a "procedure" and get in return a object whith the same name as the string?
View 8 Replies
Dec 12, 2011
I'm needing to go through all the controls on a page, looking for a specific one. We've got a bunch of user controls, a masterpage, content panel, &c.
The basic idea is simple, but once I find the control I want, say five 'layers' in, the control is returned only one level.
I know I can do something cheesy like having a private variable and assigning the control to that down in the rabbit hole, but I figure there must be a more official method of doing this.[code]...
View 2 Replies
Jun 19, 2012
I have question about returning an object from a class. example of my codeclass ADDBUTTON:
Dim test As New Button
test.name ="NAME" (radom generated)
start.controls.add(test)
[code].....
View 2 Replies
Jun 27, 2009
what if the session object is not present
what will it return if CType(Session("pid"), String) is not present
View 5 Replies