Answer:-

I am working .net application. I have this error when i open my application solution file and build my application that time getting this error.

 and then i referred in this link.

he mentioned about I won't open the parent folder solution file. that's the reason happens this error. 

Basically, the error means that there is a web.config file in one of your subfolders that has a configuration element that it should not have. Is this you root/only web config file? If not, could you please post those as well? Also, it sounds stupid, but I would double check that you're opening the website itself in your IDE (and not mistakenly opening a parent folder) I have seen people spend a couple hours trying to debug this same error, when all along they weren't in the right directory. Here is a good explanation on how the web.config hierarchy is set up for ASP that will help you visualize how this works:

http://scottonwriting.net/sowblog/archive/2010/02/17/163375.aspx



Read more ...

Multiple CustomActionData fields

Posted by senthil | 8:02:00 AM | , , | 0 comments »

This is multiple CustomActionData field pass in SetUp  file.

 it is possible to add one or more custom screens in the setup wizard, with fields (e.g. text boxes) where the user can enter additional installation parameters.
A custom field can then be passed to a "Custom Action" class library project, to handle the user field. The image below shows how the property "ServerName" gets mapped to the EDITB1 text field:


Within the Custom Action class, the property is accessed as follows:
string targetdir = Context.Parameters["TARGETDIR"];
string stationname = Context.Parameters["STATIONNAME"];
string facility = Context.Parameters["FACILITY"];
string line = Context.Parameters["Line"];
string email = Context.Parameters["Email"];
string environment = Context.Parameters["ENVIRONMENT"];
/TARGETDIR="[TARGETDIR]\" /STATIONNAME="[STATIONNAME]" /FACILITY="[FACILITY]" /LINE="[LINE]" /EMAIL="[EMAIL]" /ENV="[ENVIRONMENT]"
Read more ...

I have a service setup. It has one shortcut in application folder (In Users program menu). When I try to install installation has completed with no issues. But after installation when I click the shortcut the first time open the application and then when i click the shortcut in Second time the service application is re-installing again and showing error like "Error 1001. The specified service already exists". If I click "OK" of the error dialog if is showing a dialog "Fatal error during installation." with the title "Problem with shortcut". I am using C# for the development. Event log is as below


 The description for Event ID ( 11001 ) in Source ( MsiInstaller ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Product: "My Project Solutation" -- Error 1001. Error 1001. The specified service already exists, (NULL), (NULL), (NULL), (NULL), , .


0000: 7b 33 34 42 41 38 32 44 {34BA82D
0008: 39 2d 31 44 39 45 2d 34 9-1D9E-4
0010: 33 39 38 2d 42 38 30 31 398-B801
0018: 2d 43 42 46 33 35 43 37 -CBF35C7
0020: 32 46 42 34 39 7d 2FB49}
Read more ...

This code create a new roundedbutton for wpf application.

Its easy understand and customes button style. I want to create rounded button for in my application and style effect change when Button Enable and Disable time after that IsEnable time when i click the button that style change like a normal button.

Here i used in Gradient color also we can customes


<Button Command="Print" Name="butSinglePrint" Height="40" Width="40" Margin="6">
        <Button.Template>
            <ControlTemplate TargetType="Button">
                <Grid>
                    <Ellipse 
                         StrokeThickness="2">
                        <Ellipse.Fill>
                            <RadialGradientBrush GradientOrigin="0.496,1.052">
                                <RadialGradientBrush.RelativeTransform>
                                    <TransformGroup>
                                        <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.5" ScaleY="1.5"/>
                                        <TranslateTransform X="0.02" Y="0.2"/>
                                    </TransformGroup>
                                </RadialGradientBrush.RelativeTransform>
                                <GradientStop Offset="1" Color="Green"/>
                                <GradientStop Offset="0.2" Color="Green"/>
                            </RadialGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>                    
                    <Ellipse Margin="3" Name="highlightCircle">
                        <Ellipse.Fill >
                                                <LinearGradientBrush>
                                                    <GradientStop Offset="0" Color="#50FFFFFF"/>
                                                    <GradientStop Offset="0.5" Color="#00FFFFFF"/>
                                                    <GradientStop Offset="1" Color="#50FFFFFF"/>
                                                </LinearGradientBrush>
                                            </Ellipse.Fill>
                    </Ellipse>
                    <Ellipse Name="disableCircle" >
                        <Ellipse.Fill>
                                                <LinearGradientBrush >
                                                    <GradientStop Offset="0" Color="#50FFFFFF"/>
                                                    <GradientStop Offset="0.5" Color="#00FFFFFF"/>
                                                    <GradientStop Offset="1" Color="#50FFFFFF"/>
                                                </LinearGradientBrush>
                                            </Ellipse.Fill>
                    </Ellipse>
                    <Border Name="highlightBorder"  BorderBrush="#002A00" CornerRadius="18" BorderThickness="0,0,1,1">
                        <ContentPresenter HorizontalAlignment="Center"
                                  VerticalAlignment="Center"/>
                    </Border>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter TargetName="highlightBorder"  Property="FocusVisualStyle" Value="{x:Null}"/>
                        <Setter TargetName="highlightBorder"  Property="BorderThickness" Value="1,1,0,0" />
                        <Setter TargetName="highlightBorder"  Property="BorderBrush" Value="#002A00" />                       
                        <Setter TargetName="highlightCircle" Property="Fill">
                                                <Setter.Value>
                                                    <LinearGradientBrush StartPoint="0.3,0" EndPoint="0.4,1">
                                                    <GradientStop Offset="0" Color="#50FFFFFF"/>
                                                    <GradientStop Offset="0.5" Color="#00FFFFFF"/>
                                                    <GradientStop Offset="1" Color="#50FFFFFF"/>
                                                </LinearGradientBrush>
                                                </Setter.Value>
                                            </Setter>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter TargetName="disableCircle" Property="Fill">
                            <Setter.Value>
                                <LinearGradientBrush StartPoint="0.6,0" EndPoint="1.4,1">
                                    <GradientStop Offset="0" Color="#C3C8C9"/>
                                    <GradientStop Offset="0.5" Color="#CFD3D4"/>
                                    <GradientStop Offset="2" Color="#9A9FA1"/>
                                </LinearGradientBrush>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="True">
                        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                        <Setter TargetName="highlightBorder"  Property="BorderThickness" Value="1,1,1,1" />
                                        <Setter TargetName="highlightBorder" Property="BorderBrush">
                                            <Setter.Value>
                                                <LinearGradientBrush StartPoint="0.6,0" EndPoint="1.4,1">
                                                    <GradientStop Offset="0" Color="#3FFF3F"/>
                                                    <GradientStop Offset="0" Color="#3FFF3F"/>
                                                    <GradientStop Offset="0.5" Color="#002A00"/>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>                  
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Button.Template>
    </Button>
Read more ...

Sample Multi thread Functionality in C#

Posted by senthil | 6:43:00 PM | , | 0 comments »

this code sample main class i created multi thread concept. already i used thread in my application while call my method continuously but there is deadlock occurred because already different thread runing there so thats what i used multi thread like this.
using System; 
using System.Threading; 
public class Test { 
static void Main() { 
ThreadStart job = new ThreadStart(ThreadJob); 
Thread thread = new Thread(job); 
thread.Start();
 for (int i=0; i < 5; i++) { 
Console.WriteLine ("Main thread: {0}", i); 
Thread.Sleep(1000); 
}
 }
 static void ThreadJob() { 
for (int i=0; i < 10; i++) {
 Console.WriteLine ("Other thread: {0}", i); 
Thread.Sleep(500); 
}
}
 } 
Read more ...

I am working in wpf application. i want to call the print method till when i click stop button. So that case i have used in thread concept while i was getting This error 'The calling thread cannot access this object because a different thread owns it' because also multiple thread run in that method so i handled this type of solution. my print method called in PrintElement like this;
public static PrintLable PrintElement()
{
    PrintLable printLable= null;
    Application.Current.Dispatcher.Invoke(
       System.Windows.Threading.DispatcherPriority.Normal, new Action(
          delegate()
          {
              PrintElement printLable = new PrintElement();
              // Initialize your PrintElement here
          }));
    return printLable;
}
Read more ...

This is all the USB device read from your local machine using C#. I am working in wpf windows application. When i want to read my system USB Device i got this sample code. This code every easy to learn and implement as you want. just copy and past in your application.
public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

  static void Main()
        {
            var usbDevices = GetUSBDevices();

            foreach (var usbDevice in usbDevices)
            {
                Console.WriteLine("Device ID: {0}, PNP Device ID: {1}, Description: {2}",
                    usbDevice.DeviceID, usbDevice.PNPDevideID, usbDevice.Description);
            }

            Console.Read();
        }


        static List<USBDeviceInfo> GetUSBDevices()
        {
            List<USBDeviceInfo> devices = new List<USBDeviceInfo>();

            ManagementObjectCollection collection;
            using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_USBHub"))
                collection = searcher.Get();

            foreach (var device in collection)
            {
                devices.Add(new USBDeviceInfo(
                (string)device.GetPropertyValue("DeviceID"),
                (string)device.GetPropertyValue("PNPDeviceID"),
                (string)device.GetPropertyValue("Description")
                ));
            }

            collection.Dispose();
            return devices;
        }
    }

    class USBDeviceInfo
    {
        public USBDeviceInfo(string deviceID, string pnpDeviceID, string description)
        {
            this.DeviceID = deviceID;
            this.PNPDeviceID = pnpDeviceID;
            this.Description = description;
        }
        public string DeviceID { get; private set; }
        public string PNPDeviceID { get; private set; }
        public string Description { get; private set; }
    } 
Read more ...

LINQ using XML data load to combobox.

Posted by senthil | 8:40:00 PM | , , | 0 comments »

To use LINQ to XML you will need to import a two of namespaces.
using System.Linq;
using System.Xml.Linq;


private void StudentsLoad()
{
  var xElem = XElement.Load(@"Student.xml");

  var students = from prod in xElem.Descendants("Student")
           orderby prod.Element("StudentName").Value
           select prod.Element("StudentName").Value;

  lstStudents.DataContext = students;
}
Read more ...

When i want to xml data load to the combobox . i got this solution. Its very simple to load the xml data. this the xml data.
<Items>
  <Item>
    <ItemId>1</ItemId>
    <ItemName>Architecting ASP.NET Applications
                 eBook</ItemName>
    <Price>19.95</Price>
  </Item>
  <Item>
    <ItemId>2</ItemId>
    <ItemName>Fundamentals of N-Tier eBook</ItemName>
    <Price>19.95</Price>
  </Item>
     ...
     ...
  <Item>
    <ItemId>3</ItemId>
    <ItemName>Security for ASP.NET Developers
                 eBook</ItemName>
    <Price>19.95</Price>
  </Item>
</Items>
this is stackpanel resource load, it will load on window loaded
<StackPanel.Resources>
  <XmlDataProvider x:Key="ItemsData"
                   Source="/Items.xml"
                   XPath="Items/Item" />
</StackPanel.Resources>
Its a combobox wirte like this, i loaded in ItemName if you want price load to another one combobox just change the xPath and then automatically load the price data to the combobox.
<ComboBox Name="Items" MinWidth="200" Style="{StaticResource RequiredComboBox}" Foreground="Black" FontSize="30" IsSynchronizedWithCurrentItem="False" SelectedIndex="0">
                    <ComboBox.ItemContainerStyle>
                        <Style TargetType="ComboBoxItem">
                            <Setter Property="Padding" Value="5">
                            </Setter>
                        </Style>
                    </ComboBox.ItemContainerStyle>
                    <ComboBox.ItemsSource>
                        <Binding Source="{StaticResource ItemsData}" XPath="ItemName" />
                    </ComboBox.ItemsSource>
                </ComboBox>
Read more ...

This code XML data load to gridview in wpf application. when i want to xml data load to the gridview using back end csharp code. its very simple. 1. Create DataSet object and then 2. Load the xml file to dataset using readxml property. 3. dataset value pass to the gridview itemsource.
DataSet dataSet = new DataSet();

dataSet.ReadXml(@"C:\Students\Students.xml"); 

dataGrid1.ItemsSource = dataSet.Tables[0].DefaultView; 
Read more ...

I am working in wpf application when i want to open the child window from Parent window button click. that time i am getting this solution. Just write Parent window click event method like this.
private void Button_Click(object sender, RoutedEventArgs e)
        {            
            window2 win2= new window2();
            win2.Show();
            this.Close();
        }
Read more ...

This code create an round button in wpf application using ResourceDictionary. create an xaml file like this.
<ResourceDictionary 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >

<Style x:Key="RoundButtonTemplate" TargetType="Button">
        <Setter Property="Background" Value="Brown"/>
        <Setter Property="Foreground" Value="White" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border CornerRadius="15" Background="{TemplateBinding Background}"
                                BorderThickness="1">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center">

                        </ContentPresenter>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
after that create and main window xaml file and then just call this RoundButtonTemplate style using Window.Resources load the GlassButton.xaml file and then call the StaticResource in main window like this.
<Window x:Class="GlassButton.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Glass Buttons" Height="228" Width="272">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources\GlassButton.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
<Grid>
 <StackPanel Orientation="Horizontal">
<Button Focusable="False"
        Style="{StaticResource RoundButtonTemplate}"
        Width="264"
       Height="90" 
       Grid.Row="0"
       Margin="0,0,0,0"
       HorizontalAlignment="Center"
       BorderBrush="#FFF"
       Name="PasswordButton"
       Click="PasswordButton_Click"> 
                                             
 </Button>
  </StackPanel>
</Grid>
</Window>
Read more ...

This is code i have an exprience when i want to create a round button in my application i have used this code. this is one way of the create round button in wpf application. if we want change the color and Radial Gradient color and also we can able to apply the Transform using opacity. its very useful i have past the following code.
<Button Width="100" Height="100">
                <Button.Template>
                    <ControlTemplate TargetType="Button">
                        <Grid>
                            <Ellipse Stroke="#5ECF5E"
                         StrokeThickness="2">
                                <Ellipse.Fill>
                                    <RadialGradientBrush GradientOrigin="0.496,1.052">
                                        <RadialGradientBrush.RelativeTransform>
                                            <TransformGroup>
                                                <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.5" ScaleY="1.5"/>
                                                <TranslateTransform X="0.02" Y="0.2"/>
                                            </TransformGroup>
                                        </RadialGradientBrush.RelativeTransform>
                                        <GradientStop Offset="1" Color="#5ECF5E"/>
                                        <GradientStop Offset="0.2" Color="#FFFFFFFF"/>
                                    </RadialGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <ContentPresenter HorizontalAlignment="Center"
                                  VerticalAlignment="Center"/>
                        </Grid>
                    </ControlTemplate>
                </Button.Template>
            </Button>
another one way to create the round button.
<Button  Width="100" Height="100" Content="Abcd">
        <Button.Template>
            <ControlTemplate TargetType="{x:Type Button}">
                <Grid>
                <Ellipse Fill="Red"/>
                    <ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </Grid>
            </ControlTemplate>
        </Button.Template>
    </Button>
this code create an rectangle button with color and Radial Gradient color and also we can able to apply the Transform using opacity.
<UserControl x:Class="WindowsFormsApplication8.UserControl1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="154" Width="177">
    <Grid>
        
        <Rectangle Name="rectangle1" Stroke="Black" RadiusX="10" RadiusY="10" >
        </Rectangle>
 
        <Button Name="rectangle2" Foreground="Black" Margin="3,3,3,3" >
            <Button.Background >
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="Green" Offset="0.0" />
                    <GradientStop Color="White" Offset="0.9" />
                </LinearGradientBrush>
            </Button.Background>
        </Button>
    </Grid>
</UserControl>
Read more ...

This Warning i have experienced. When i going to change the Windows .Net Framework installer i had changed .Net Framework version 3.5 to version 4.0 that time i'm getting this issue. Its a easy to fix in this issue. Just Right click the setup solution explorer file and click the "view" and then click "Launch Conditions" the Issue founded.


and then Right Click the Launch Conditions "Properties Windows"




after that select the correct .Net Framework version





after that Right click the setup solution explorer file and select the properties




there is select on "Prerequsities" selection correct .Net Framework version.


Read more ...

When i click the button i want to assign the textbox value from another class.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        Download myDownload = new Download();
        static string textBoxString;
        public Form1()
        {
            InitializeComponent();
        }

        public static string TextboxText
        {
            set { textBoxString = value; }
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            myDownload.Do();
            textBox1.Text = textBoxString;
            textBox1.Invalidate();
        }
    }

    public class Download
    {
        public void Do()
        {
            Form1.TextboxText = "My text";
        }
    }
}

An even better solution would be to define the possible interactions in an interface, and let that interface be the contract between your form and the other class. That way the class is completely decoupled from the form, and can use anyting implementing the interface (which opens the door for far easier testing):

interface IYourForm
{
    string FirstName { get; set; }
}

In your form class:


class YourFormClass : Form, IYourForm
{
    // lots of other code here

    public string FirstName
    {
        get { return firstNameTextBox.Text; }
        set { firstNameTextBox.Text = value; }
    }
}
...and the class:


class SomeClass
{
    private readonly IYourForm form;
    public SomeClass(IYourForm form)
    {
        this.form = form;
    }

    // and so on

}
Read more ...

Windows installer error

Posted by senthil | 1:26:00 PM | , | 0 comments »

When i install my wpf installer while getting error like this. any body know about this issue.

Question :-

Error 1001. Unable to get installer types in the C:\\YM\ConfigUI\ConfigUI.exe assembly. --> Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

 The description for Event ID 11001 from source MsiInstaller cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

 If the event originated on another computer, the display information had to be saved with the event.

 The following information was included with the event: Product: YottaMark Case Labeling Solution -- Error 1001. Error 1001. Unable to get installer types in the C:\YM\ConfigUI\ConfigUI.exe assembly. --> Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
(NULL)
(NULL)
 (NULL)
(NULL)
(NULL)
 the message resource is present but the message is not found in the string/message table

Answer : -

Based on the error message in your second comment, it appears that your ConfigUI.exe assembly has been added as a Custom Action with the InstallerClass property set to true, but either no installer classes could be found in the exe or the exe could not be loaded due to missing dependencies.

You can see the list of Custom Actions by right-clicking on the installer project, selecting View and then Custom Actions.

If your exe does not can an installer class, then you can remove it from the list of custom actions.

If it does contain an installer class, then the issue is going to be missing dependencies. If fuslogvw doesn't work for you (it has always helped resolve this kind of issue for us), you can carefully review the list of references in the exe's project and compare them to what is listed in the installer project.

The other trick that we use is to examine the install directory while the error message is displayed on the screen. We can often see that DLLs are missing by doing this, usually because the path was entered incorrectly in the DLL entry within the installer project or because a condition was set incorrectly.

Read more ...

Related Posts Plugin for WordPress, Blogger...