.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

C++ Q&A: Initializing Class Objects, The TestAD App and Active Desktop, #include Problems

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
 

More Related Resource Links

Class which contains an array of objects of type "Class2"

  

 

1  Partial Class _Default
2  Inherits System.Web.UI.Page

3 Public Function Ohjoy(ByVal X As Integer) As Integer
4 Dim theClass As New Class1 '= New Class1()
5    theClass.ReSize(0)
6    theClass.myBaby(0).GetName(0) = "Hello" 'Property Chars is read only'
7    Return 1
8 End Function
I have a first class named "Class1". I have a second class named "Class2" Class2, is a member of class 1,
and is implemented as an array of objects of type Class 2.

If I try and call the Accessor GetName() my hard coded value "Hello" in my accessor is not returned? Only
an alpha character like "T"

Also if I try and assigne a value using the setter GetName() it does not work, and the compiler gives me
an error message "property Chars is ReadOnly? Does anyone know what is wrong in my code? Line 6 above

 

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Ohjoy(1)
End Sub
End Class

Public Class Class1
    Dim bs As Integer
    Public myBaby() As Class2
    Public myB As Class2
    Public Function ReSize(By

Problems with References in objects

  
Hello!! I'm having a problem very specific.. using C# and asp.net I Have a ToolBar(made by myself) that have a DataGrid (made by myself too) as a property on it. In the Page_Load, I instantiate a grid, then instantiate a toolbar and assign the property "grid" of the toolbar to the newly created grid. My grid has a delegate to DataRendering, that i made an override in the aspx.cs page. In this DataRendering, I've hidden some columns of the grid. But, when I try to access the Grid property in the toolbar object, the columns are in the initial state..... I've try to assign as a reference, using the ref keyword, but the result was the same... Someone here already pass through a situation like this? Thanks

How to make an array of class objects in Visual Basic

  
How can I make an array of objects in VB.net. Here is the requirement.Basically I have a class named hotel. I need to dynamically add customersto the hotel class using the Customer class. So basically if in the Hotelclass I can have an array of Customer objects that would be great. How can I do this in VB .net ? Public Class Hotel  ' I need an array of Customer objects. objCustomers End Class   Public Class Customer Private custId As Integer Private custName As String Private custAddress As String Private custCity As StringEnd Class Pseudo code:  Dim Hilton As Hotel = new Hotel()   Hilton.objCustomers(5) ' Declare an array of 5 customer objects   Hilton.objCustomers(0).CustId=1  Hilton.objCustomers(0).CustName="JoJo Smith"  Hilton.objCustomers(0).custAddress="122 Emory Lane"  Hilton.custCity="Merry More"  .  .  .  Hilton.objCustomers(4).CustId=1  Hilton.objCustomers(4).CustName="Ice Baby"  Hilton.objCustomers(4).custAddress="66 Domino Drive"  Hilton.custCity="Miami"    End While

Problems with References in objects

  
Hello!! I'm having a problem very specific.. using C# and asp.net I Have a ToolBar(made by myself) that have a DataGrid (made by myself too) as a property on it. In the Page_Load, I instantiate a grid, then instantiate a toolbar and assign the property "grid" of the toolbar to the newly created grid. My grid has a delegate to DataRendering, that i made an override in the aspx.cs page. In this DataRendering, I've hidden some columns of the grid. But, when I try to access the Grid property in the toolbar object, the columns are in the initial state..... I've try to assign as a reference, using the ref keyword, but the result was the same... Someone here already pass through a situation like this? Thanks

class contains non-dependency-property data members that are DependencyObject objects, you must also

  

I was reading the article Freezable Objects Overviewand came acrosee the statement

"If  your class contains non-dependency-property data members that are DependencyObject objects, you must also call the OnFreezablePropertyChanged method each time you change on of their values, even if you're setting the member to null. "

I quite do not understand the part about non-dependency-property data members that are DependencyObject objects. Can some one explain exactly what this means? If a data member is derived from the DependencyObject  class how then can the data member be a non dependency property?

I am also trying to locate some source code / project that overrides the OnFreezablePropertyChanged method, and have yet to find any on the interenet.

If anyone know whe

using UpdateSourceTrigger=Explicit with GetBindingExpression() on class objects with inherited

  

 

I have a class that inherits from FrameworkElement and has a mixture of DPs that I've added and the ones inherited e.g. WidthProperty, HeightProperty etc...

I have a UserControl that inherits from my class and has various textboxes in a popup resource like this

<TextBox Text="{Binding Path=Width, UpdateSourceTrigger=Explicit}" />

I've added a click button so that when the user changes one of the textboxes (in the popup), a routedUIcommand will fire (see below).

 

 public static void OkCommand_Executed(object sender, RoutedEventArgs e)
    {
      MyClass c = (MyClass)sender;

//this seems to work fine because it is implicitly declared in my class
      BindingExpression be = s.GetBindingExpression(MyClass.MyPropertyProperty);
      if (be != null) be.UpdateSource();


//this does not work because the DP is inherited from FrameworkElement. It is returning null.
      BindingExpression be = s.GetBindingExpression(MyClass.WidthProperty);
      if (be != 

How to create an array of VB.net objects from a VB .net class

  

I need to create an array of a class type. Populate the values in the class and then pass
the array to a subroutine. I havent figured out how to do this properly as I get a null
reference exception. Can someone show me how to create/instantiate the array of objects?
Here is a simple example with only one property named "_momentum". My actuall class has about
10 properties/variables in actuality


Public Class Torsion

 Dim _momentum As integer

 Public Property Momentum
    Get
            Return _momentum
    End Get
    Set(ByVal As Integer)
      _momentum = value
End Propterty

' Later in the code I try to create and object of the class
'----------------------------------------------------------

Dim x(0) As Torsion
X(0).Momentum=300


Problems Updating Active Directory

  

I am trying to write this class to allow users to update their active directory information from a webform. The problem I am having now is in the updateADInfo( ) method the variable sResults never gets assigned to anything. I've gone through the code several times, debugg mode as well and can't figure out why it would keep sResult as nothing. I am posting pretty much the whole thing here:

 

    Protected Function GetADPath() As DirectoryEntry
        Dim adPath As New DirectoryEntry("LDAP://DC=shstest,DC=net")
        'Dim adPath As New DirectoryEntry("LDAP://DC=int,DC=samhealth,DC=net")
        adPath.Username = Nothing
        adPath.Password = Nothing
        adPath.AuthenticationType = AuthenticationTypes.Secure
        Return adPath
    End Function
	
    Protected Function GetWinUser() As String
        Dim winUser As String = HttpContext.Current.User.Identity.Name.Split(New Char() {"\"c})(1)
        Return winUser
    End Function
	
    Private Sub UpdateADInfo(ByVal phoneUPD As String, ByVal locationUPD As String, ByVal officeUPD As String, ByVal deptUPD As String)
        
        Dim adPath As DirectoryEntry = GetADPath()
        Dim ds As DirectorySearcher = New DirectorySearcher(adPath)
        
        ds.Filter = "(&(objectCatagory=Person)(objectClass=User)(SA

Problems on WF4 Services, Security and Large Objects

  

Dears,

I have a big problem on using WF4 service. There are several questions I cannot find the answer yet.
Hope that anyone can share their experience to me on solving the following problems.

1. How to change the configuration for each WF4 services ?
    I have created several workflow services and once they build, I can find the service by adding a service reference on the client side.
    However, I need to pass a large object such as image or movie like >20MB file to the WF4 service.
    But I cannot find any configuration on the web.config file on the server side that allow me to change the settings like maxArrayLength,
    maxBufferPoolSize ... 

    For these large objects, is that using streaming mode is the best practice? 
    Actually, where can I find those configuration settings for a xamlx file ?
    And, how can I configure the WF4 service to use Streaming transfer mode on server side?
   
    In addition, I need to verify the user's identification inside the workflow rather than let them pass in a username and password
    for security reasons. If I need to do so, I might need to

Top .NET Performance Problems and how to avoid them

  
Every time I work with one of our .NET customers to help them with managing their application performance I come across the same problems as seen with other clients before: lots of ADO.NET queries, many hidden exceptions in core or 3rd party .NET libraries, slow 3rd party components, inefficient custom code

Class Diagrams

  
Class diagrams show the static structure of the systems. Classes define the properties of the objects which belong to them. These include:

Attributes - (second container) the data properties of the classes including type, default value and constraints.

Creating a Simple Class in C#

  
The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

Static Class for Beginners

  
In general, the members of a class can be accessed by instance of that class when they are in public, but there comes a situation to access or call members of a class without an instance and this can be achieved by declaring them as static

abstract away the source of the connection string using a class with a static property.

  
ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Encapsulation
Let's abstract away the source of the connection string using a class with a static property.

Control your Pocket PC with your desktop

  
My Mobiler is a Free tool that allows you to use your desktop keyboard, mouse and monitor to navigate and control your Windows Mobile Pocket PC. With it you can view your Windows Mobile screen on your desktop PC. This makes it easy to "control your Windows mobile device with a desktop keyboard and mouse". Moreover, you can drag and drop files from your desktop to your windows mobile device, Cut and paste text from your desktop PC to your Windows mobile device and capture your windows mobile screen or even stream capture from your desktop PC.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend