Quantcast
Channel: CSharp Forum Latest Questions
Viewing all 32062 articles
Browse latest View live

Petzold code problem

$
0
0
I'm trying to run the following code (pages 32-33 of Petzolds Programming Windows 6th Edition)

using MSVS2012 Pro on Windows 8 Pro 64-bit.

(first excerpt from MainPage.xaml

    <Grid Name="contentGrid"
        Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <TextBlock Name="txtblk"
                    Text="Hello, Windows 8!"
                    FontSize="96"
                    FontWeight="Bold"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center" />
    </Grid>

(second excerpt from MainPage.xaml.cs)

public MainPage()
        {
            this.InitializeComponent();
 
            // Create the foreground brush for the TextBlock
            LinearGradientBrush foregroundBrush = new LinearGradientBrush();
            foregroundBrush.StartPoint = new Point(0, 0);
            foregroundBrush.EndPoint = new Point(1, 0);
            GradientStop gradientStop = new GradientStop();
            gradientStop.Offset = 0;
            gradientStop.Color = Colors.Blue;
            foregroundBrush.GradientStops.Add(gradientStop);
            gradientStop = new GradientStop();
            gradientStop.Offset = 1;
            gradientStop.Color = Colors.Red;
            foregroundBrush.GradientStops.Add(gradientStop);
            txtblk.Foreground = foregroundBrush;
            // Create the background brush for the Grid
            LinearGradientBrush backgroundBrush = new LinearGradientBrush
            {
                StartPoint = new Point(0, 0),
                EndPoint = new Point(1, 0)
            };
            backgroundBrush.GradientStops.Add(new GradientStop
            {
                Offset = 0,
                Color = Colors.Red
            });
            backgroundBrush.GradientStops.Add(new GradientStop
            {
                Offset = 1,
                Color = Colors.Blue
            });
            contentGrid.Background = backgroundBrush;
        }

I get the following errors:

Error    1    The name 'Colors' does not exist in the current context    C:\TestProjects\Petzold

\GradientBrushCode\GradientBrushCode\MainPage.xaml.cs    34    34    GradientBrushCode
Error    2    The name 'Colors' does not exist in the current context    C:\TestProjects\Petzold

\GradientBrushCode\GradientBrushCode\MainPage.xaml.cs    38    34    GradientBrushCode
Error    3    The name 'Colors' does not exist in the current context    C:\TestProjects\Petzold

\GradientBrushCode\GradientBrushCode\MainPage.xaml.cs    50    25    GradientBrushCode
Error    4    The name 'Colors' does not exist in the current context    C:\TestProjects\Petzold

\GradientBrushCode\GradientBrushCode\MainPage.xaml.cs    55    25    GradientBrushCode

I searched and found similar posts that suggest adding:

using System.Drawing

I tried that but got another compiler error:

Error    1    The type or namespace name 'Drawing' does not exist in the namespace 'System' (are

you missing an assembly reference?)    C:\TestProjects\Petzold\GradientBrushCode\GradientBrushCode

\MainPage.xaml.cs    2    14    GradientBrushCode

I have no idea what to do.

Please help.

David

My ajax EditorControl not working at production environment

$
0
0
Hello,

I am facing problem with my AJAXToolkit Editor control. Everything is working fine on local. But in production enviroment, its not working.
My site is in .Net 3.5 framework and I am using 3.5 version of AJAXToolkit on IIS 6.

Thanks

SQL SERVER TEMP TABLE

$
0
0
How to iterate dynamic column data in sql server?

How to add another row with above data using datagridviewlin

$
0
0

Hi All,

I am using datagridviewlink column. when i clikc on that link it display another row with the above data in daagridview
Ex:-- Datagriview
Senario is a database value
Usernetry is a Textbox column
Link Link column

 Senario    Userentry  Link
  123                   Add
  456                   Add
  789                   Add

when i clik on link column from datagridview, it will add another row with prevoius data
Ex:--
Senario    Userentry  Link
 123                   Add
 456                   Add  Here I am clik on 2nd row
 789                   Add 
<u>Out Put</u>
Senario    Userentry  Link
 123                   Add
 456                   Add
 456                   Add
 789                   Add

Please any one give me the suggestion.

Regards,
Sucharitha

How to transfer a file from my pc to server..

$
0
0
Hi,   I've a problem in my project. i need ur help friends.


1) in my project i'm using barcode scanner . when i connect the scanner and click the "import" button ,
    the text file in barcode scanner have to move to my server's path.


2) i've given a path like ("\\dellserver\barcode\barcode.txt"). This is working fine where the system are connected through LAN.


3) But What i need is 
     
     When i execute the same program without LAN means how can i give that server path?? or any other way to move my barcode text file to server's barcode folder??


if yes, plz share ur answer..

How to get Row data from Jqgrid to another view/Controller

$
0
0
Hii to all,
   I Have a requirement that i need to retrive  one r more table's data from DataBase (SQLServer)& display in a Jqgrid.Up to here i have done using Linq Joins&EntityFramework,and one more requirement where i strucked is,here in Jqgrid i have made Multiselect to True,after displaying the table data in Jqgrid the respective checked row's data i need to get in another view say Editable view where i need to dispaly this row data in Textboxes in Editable mode,here user will update the records present in Textboxes and when he press Updata button,the records should be updated to DataBase& also we need to redirect to previous View(after clicking update button in Editable View)
 i.e Jqgrid view & display the modified records in Jqgrid.
Here is my Jqgrid View code  say "GetTablesData":-
@model MVCLINQJoins.Models.TableData<linkhref="@Url.Content("~/Content/themes/base/ui.jqgrid.css")"rel="stylesheet"type="text/css"/><scriptsrc="@Url.Content("~/JS/jquery-1.7.2.min.js")"type="text/javascript"></script><scriptsrc="@Url.Content("~/JS/jquery.jqGrid.min.js")"type="text/javascript"></script><scriptsrc="@Url.Content("~/JS/grid.locale-en.js")"type="text/javascript"></script>
@{
    ViewBag.Title = "GetTablesData";
}<h2>
    GetTablesData</h2><scripttype="text/javascript">var mdata = []</script>
@foreach (var item in Model.getEmployeeDetails)
{<scripttype="text/javascript">
        row = { EmployeeID: '@item.EmployeeId', EmpName: '@item.EmpName', Designation: '@item.Designation', Salary: '@item.Salary', MobileNo: '@item.MobileNo', Email: '@item.Email' };
        mdata.push(row);</script>
}<tableid="emp-data-grid"></table><scripttype="text/javascript">
    $("#emp-data-grid").jqGrid({
        datatype: "local",
        data: mdata,
        colNames: ["EmployeeID", "EmpName", "Designation", "Salary", "MobileNo", "Email"],
        colModel: [
                { name: "EmployeeID", index: "EmployeeID", editable: true, edittype: "checkbox", editoptions: { value: "Yes:No"} },
                { name: "EmpName", index: "EmpName" },
                { name: "Designation", index: "Designation" },
                { name: "Salary", index: "Salary", sorttype: "int" },
                { name: "MobileNo", index: "MobileNo", sorttype: "int" },
                { name: "Email", index: "Email" }
            ],
        shrinkToFit: true,
        multiselect:true,
        caption: "Employee List" 
    }); </script>
    @Html.ActionLink("EDIT", "Edit")
when he click on above Edit link,i need to get the respective rows data to Edit View.
Here is My Controller Code:-
public ActionResult GetTablesData()
        {
            TableData model = new TableData();
            model.getEmployeeDetails = new List<Employee>();
            GetDataFromDB(model);
            return View(model);
        } 
        private static void GetDataFromDB(TableData model)
        {
            using (personalEntities2 db = new personalEntities2())
            {
                var emply = (from empd in db.empdetails
                             join empp in db.emppersonals on empd.empid equals empp.empid
                             orderby empd.empid
                             select new
                             {
                                 empd.empid,
                                 empd.ename,
                                 empd.designation,
                                 empd.salary,
                                 empd.deptno,
                                 empp.mobileno,
                                 empp.email
                             });
                foreach (var item in emply)
                {
                    Employee ed = new Employee();
                    ed.EmployeeId = item.empid;
                    ed.EmpName = item.ename;
                    ed.Designation = item.designation;
                    ed.Salary = item.salary;
                    ed.DeptNo = item.deptno;
                    ed.MobileNo = item.mobileno;
                    ed.Email = item.email;
                    model.getEmployeeDetails.Add(ed);
                } 
            }
        }
        public ActionResult Edit(Employee model,int id)
        { 
          return View(model);
        }
Please guide me how to achieve my requirement along with Controller code.Thanks in advance 
Thanks
Ramu

context menu in asp.net

$
0
0
when right click on any link button then it has to show options
i.e context menu in treeview

how to download a Msword file?

$
0
0

ASP.NET WITH C# CODINGS

THIS IS FOR STUDENT

I created a form with TWO button
OPEN    SUBMITRECORD




THIS IS FOR FACULTY:

second form with ONE  button
VIEW RECORD      


The student would kept their Ms word file in their system. when the studetn click the open button then their word file from their system should be opened and when they click SUBMITRECORD button then their record should be submitted to the faculty.


Whent the faculty click the VIEW RECORD button then faculty should be abel to open the wordfile and see. 



So kindly send me coding for the above process

 I WILL BE VERY MUCH THANKFULL TO YOU

conect to online sql server through desktop application

$
0
0
hello
i want to connect to my online database through my desktop application built int c#.
i have a website where user can place order for piza and i have a desktop software where i manage local transactions. i want to get notification of order paced online. and late i want to update online database through desktop software.
can anyone help me?

3 Dropdownlistes in Edit Form

$
0
0
I have 3 dropdown list connected to each other for example When selecting the Major the other dropdown list should show the subjects related and the 3rd dropdownlist should retrieve the list of the instrouctors . In the adding form I'm using the Sqldatasource to mape it but now I need to retrieve the selected items in the dropdown list for editing . How can I implement it ?

Please Provide the Solution to scan a File with C#

$
0
0
Please Provide the Solution to scan a File with C#, We are Able to scan a file with our project, this is made in C#, So Please Provide the Solution of This Problem as soon as possible

How to resize the controls(eg.button,textbox) in windows app

$
0
0

HI,

can anyone help me, how to resize the controls(button,textbox) in the forms automatically according to the screen resolution. my resolution is 1366*768. It should run properly on 1024*768.

Thanks and regards,

Ramu





 


 

C# Custom Control Handling

$
0
0
 

Dear Colleagues

 

I am really new in c# even thought i am experienced in vb .net. For the first time i have created a form with a vertical split panel. I have already created a custom control with 7 buttons and on the initialization of the main form i have add it on the left panel. I can see my control in design mode and while running the application.

 

My problem is this: i cannot handle the click button event on my custom control. even though when i put a messagebox.show command inside a button click event the message show on runtime. when i try to load another custom control on the second panel of the main form the code passes through the initialization lines

The Consept is really simple.

 

publicpartialclassCtlSideBar : UserControl

    {

public CtlSideBar()

        {        

  InitializeComponent();

        }

privatevoid BtnCount_Click(object sender, EventArgs e)

        {         

var          CountControl = newCtlCounter();

MainFrm.panel2.controls.add(CountControl);

            CountControl.Visible = true;

MessageBox.Show("test");

        }

    }

The above code is written inside the btncount click event of a button on my first control (Its the Sidebar of My application and it its initialized on the main form ). the CountControl will not be shown probably because its not added on the main form. But my problem is that i don't know how to associate the event of the button of first control with the right panel on the main form. ( Line MainFrm.panel2.controls.add(CountControl);its not recognized)

Probably all the above are really simple. Don't Know. But i would appreciate any help given

Thanks in advanced and if there is any misunderstanding because my English is not very good pleade feel free to ask me anything.

scrabble tournament system

$
0
0
i am new in C# but i have a project am working on for my graduation. my project is designing a scrabble tournament system. the biggest challenge am facing is how to generate draws, pairing players while using the round robin and random pairing system please help me because am now late
in submitting it. i hope you be fair to me. i am also using mysql as my database


import and export database in sql server

$
0
0
Hello
 
i have one existing sql server 2008 express r2 database file.
in my mechine there is only sql server 2008 express.
how to open that existing file in sql server 2008 express.

Transfer Data one server to another

$
0
0
I want use  insert into sql query sqlserver2008   

like this  

insert into server2 table  select * from server1 table

but is not use

c# project related problem

$
0
0
i had created the inventory control management system in C# i tool the database as sql server
2008. Now i m getting the problem that i wanted to deploy this inventory control software in some one else pc it is showing me error of something like computername/SQLEXPRESS were as my sql instance name is DELL-PC/SQLEXPRESS how would i code that automatically get the name or instance of another database plz do reply on this .............

thanks

How can a developer explor himself outside of his current company?What are the choices?

$
0
0
How can a developer explor himself outside of his current company?What are the choices?

Connecting Visual Studio 2010 with Sql server 2012

$
0
0
Hi,

I am not able to connect sql server 2012 database with visual studio 2010 ultimate version. I have installed VS 2010 service pack 1 while installing sql server 2012. I am getting below error:

"The database C:/USERS/SACHIN/DOCUMENTS/First_Database.mdf can not be opened because it is version 706. This server supports version 655 and earlier. A downgrade path is not supported. Could not open new database C:/USERS/SACHIN/DOCUMENTS/First_Database.mdf.CREATE DATABASE is aborted. An attempt to attach an auto-named database for file C:/USERS/SACHIN/DOCUMENTS/First_Database.mdf failed. A database with the same name exists or specified file can not be opened, or it is located on UNC share."

Can you please let me know the reason for the error and how to resolve it?

Creating Word Interop chart in c#

$
0
0
I am working on creating a Interop.Word.Chart object dynamically & inserting it in word doc. I am done with the task but now i want to change the color for each data point in single series. I am using xl3dclustured column chart. Can anyone help me with this problem??
Viewing all 32062 articles
Browse latest View live