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

Open source

$
0
0
What is a good place to get involved? Codeplex?

custom rule creation in sonar for c# project

$
0
0
Hi,

I am using sonar code analysis tool for reviewing my c# project.. but I want to remove existing rules and i want to create my own rules..
I tried using xpath query but it is saving as inactive rule... please help in doing this


Thanks in advance

3D image in Windows store applications

$
0
0
Hi, 

How do i use a 3D image in my windows store application. I downloaded that 3D image from Google Warehouse.

How to include that in a image control? and i how to rotate the image using Slider control.

Please help!!

C# - Zedgraph, plotting serial data too much delay and time

$
0
0

I'm new to C# programming and trying to write an application which is part of my final thesis.

I have a microprocessor that continuously send data from a sensor to my computer via serial port. All I want is to plotting this data using Zedgraph.

The problem is that the graph got too much delay and time lag. It seems the problem happens because I continuously update the whole graph at a very high rate. I have stucked on this problem in a week and still dont find out a solution. I'll be more than happy if someone can help me out.

This is my code:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using ZedGraph;

using System.IO.Ports;

using System.Threading;


namespace DynamicData

{

publicpartialclassForm1 : Form

{

        private SerialPort port;

        privatestring buffer = "";


        privatevoid connect()

        {

            port = new SerialPort("COM8", 115200, Parity.None, 8, StopBits.One);

            port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(port_DataReceived);

            if (!port.IsOpen) port.Open();

        }


public Form1()

{

InitializeComponent();

}



privatevoid Form1_Load( object sender, EventArgs e )

{

            connect();

GraphPane myPane = zedGraphControl1.GraphPane;

            RollingPointPairList list = new RollingPointPairList(500);

            LineItem curve = myPane.AddCurve( "Sensor", list, Color.Blue, SymbolType.None );


            myPane.XAxis.Scale.Min = 0;

            myPane.XAxis.Scale.Max = 10;

            myPane.YAxis.Scale.Min = 0;

            myPane.YAxis.Scale.Max = 300;

            myPane.XAxis.Scale.MinorStep = 0.5;

            myPane.XAxis.Scale.MajorStep = 1;

          

            zedGraphControl1.AxisChange();


}



        privatevoid port_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)

        {

            //sample data: ;100*100000:

            //sampling rate ~100Hz

            buffer += port.ReadExisting();


            //flush incomplete package

            while (buffer[0] != ';')

            {

                buffer = buffer.Remove(0, 1);

                if (buffer.Length < 1) break;

            }


            //got a complete package, go to data handling

            while (buffer.Contains(":"))

            {

                DataHandling();

            }

        }



        privatevoid DataHandling()

        {

            string[] nameArray = buffer.Split(new[] { ";", ":", "*" }, StringSplitOptions.RemoveEmptyEntries);

            

            //plot sensor data vs. time

            draw(Convert.ToInt32(nameArray[0]), Convert.ToInt32(nameArray[1]));

            

            //remove handled package in buffer

            var index = buffer.IndexOf(":");

            buffer = buffer.Remove(0, index + 1);


        }


        double time = 0;

        privatevoid draw(int sensor, int t)

        {

            //convert tick to sec (uP clock rate = 16MHZ)

            time = time + (t / 16000000.0);


            // Get the first CurveItem in the graph

            LineItem curve = zedGraphControl1.GraphPane.CurveList[0] as LineItem;

           

            // Get the PointPairList

            IPointListEdit list = curve.Points as IPointListEdit;

            list.Add(time, sensor);



            //Keep the X scale at a rolling 10 second interval, with one

            //major step between the max X value and the end of the axis

            Scale xScale = zedGraphControl1.GraphPane.XAxis.Scale;

            if (time > xScale.Max - xScale.MajorStep)

            {

                xScale.Max = time + xScale.MajorStep;

                xScale.Min = xScale.Max - 10.0;

            }


            //Display sensor data

            this.Invoke(newAction(() => { textBox1.Text = byte1.ToString(); }));

            

            axisChangeZedGraph(zedGraphControl1);

            

        }


        delegatevoid axisChangeZedGraphCallBack(ZedGraphControl zg);

        privatevoid axisChangeZedGraph(ZedGraphControl zg)

        {

            if (zg.InvokeRequired)

            {

                axisChangeZedGraphCallBack ad = new axisChangeZedGraphCallBack(axisChangeZedGraph);

                zg.Invoke(ad, newobject[] { zg });

            }

            else

            {

              //  zg.AxisChange();

                zg.Invalidate();

                zg.Refresh();

            }

        }


}

}

C# share reusable library

$
0
0
I have a C# 2008/2010 application that is currently accessed as an exe file. I would like to change the application that calls the program in a 'faster and/or better' manner. To accomplish this goal, I could move the logic of the app I am starting with into a reusable library.  Then rather than calling the other program I could simply use the reusable library in the app.

The code in the calling program currently looks like the following:

strConsoleAppLocation = ConfigurationManager.AppSettings["dll_location"];
string Process_Arguments = null;
Process RPT_Process = new Process();
RPT_Process.StartInfo.FileName = strConsoleAppLocation;
Process_Arguments =  " 7 " + strCUSTID + " 1";
RPT_Process.StartInfo.Arguments = Process_Arguments;
RPT_Process.Start();
RPT_Process.WaitForExit();
RPT_Process.Dispose();

My goal is to share the same reuseable object and pass parameter values to methods that are exposed. Let me know what I suggest is a good idea or not? Also can you show me some code on how to accomplish this goal?
 

C# How to make one item from Menustrip be default selected?

$
0
0
 
I am working on C# WFA. I have one menustrip which has one item called: Settings, under this I have three items: ID, Number, and Time. Under Number item there has 5 items again which man can choose. Now I want to make it like this: first make one of the items under Number is default chosen, Secondly, I want to have one more textbox in the GUI, which will show which item is selected under number.
For example:
Settings---ID---Number----NUMBER1----Number2----Number3---Time

So I want to set the Number 2 as the default chosen item, how can I do that? I want to display the selected Number item in textbox when one is selected, How can I do that?
Thanks a lot!
BR Emma

how to add read more link to dataset in repeater control

$
0
0
currently i am working on article module of networking site.
now i want to add read more link button to article in dataset of repeater control i have no idea how to do this please help me
thanks in advance

How to show crystal report Doc in button click with Preview?

$
0
0


Dear Friends ,


                 I had one task in crystal report. That is , i want to show the crystal report in single click without moving to the 

Preview page. 

                  If anyone have any idea about this ...you can reply me 


                Thanks in advance to all..


Regards ,

Ernesto Karthik







IS Primary Key Always Better ?

$
0
0
I created a table 'Employee' .In this table colums  are Id,Name,Age,Department
.I set Primary Key for Id Column...
When Primary key setting,Creating Clustered Index Defualtly..

When Insert millions Of record,s,Each insertion ,table is sorting with the order of index
,,This will make slow,,,?

Iam Confusing With Clusterd Idexing ,NonClustered Indexing  and Primary Key

Any can Help me With Suitable Examples(With Videos)?????

xml parsing . want to access internet on emulator

$
0
0
i want  to get text  from text box (which is created in xaml dynamically )within list box,how cnamespace helloxml

  <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
           
            <ListBox Height="778" ItemsSource="{Binding}" HorizontalAlignment="Left" Margin="24,-45,0,0" Name="listBoxAuthors" VerticalAlignment="Top" Width="444" Loaded="listBox1_Loaded" SelectionChanged="listBoxAuthors_SelectionChanged">
                <phone:WebBrowser HorizontalAlignment="Center" Name="web" Margin="9,121,0,0" />
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Image Source="{Binding AuthorImage}" Width="150" Stretch="UniformToFill" HorizontalAlignment="Center" />
                            <StackPanel Width="370">
                                <TextBlock Text="{Binding AuthorName}" FontWeight="Bold" FontSize="22"  Name="id"/>
                                <TextBlock Text="{Binding Description}" Name="name" />
                                <TextBlock x:Name="srctxtbox" Text="{Binding Source}" />
                                                         </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>



 code behind it

    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
        }
        private void listBox1_Loaded(object sender, RoutedEventArgs e)
        {
            var element = XElement.Load("Authors.xml");
            var authors = from var in element.Descendants("Author")
                          orderby var.Attribute("AuthorName").Value
                          select new Authors
                              {
                                  AuthorId = Convert.ToInt32(var.Attribute("AuthorId").Value),
                                  AuthorName = var.Attribute("AuthorName").Value,
                                  AuthorImage = GetImage(var.Attribute("AuthorImage").Value),
                                  Description = var.Attribute("Description").Value,
                                  Source = var.Attribute("Source").Value
                              };

            listBoxAuthors.DataContext = authors;

        }
        public ImageSource GetImage(string path)
        {
            return new BitmapImage(new Uri(path, UriKind.RelativeOrAbsolute));
        }

        private void listBoxAuthors_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

           var listBoxItem = listBoxAuthors.SelectedItem as ListBoxItem;
           TextBlock nameBlock = listBoxItem.FindName("srctxtbox") as TextBlock;
           MessageBox.Show(nameBlock.Text);
           
      
        }
    }an i get value please help me out

Using ComboBox in vs 2012 express for windows phone

$
0
0
what is the code for using combobox in visual studio 2012 express for windows phone with xaml language ? And how to display combobox if I use database server for datasource of combobox ? please help,thank you very much :)

how to change style properties of dropdownlist to various ?

$
0
0
how can i change style properties of dropdownlist to various style in runtime ?

C# web browser

$
0
0
Hello friends i am developing a windows application(web browser) .. i want to my textbox where i enter URL to visit web site to act as Progress bar just one
                       like Safari

Datagrid binding with multiple Collections using MVVM

$
0
0
I have two Observable Collections.

1. User(UserId,Name,EmailId,RoleId)

2. Role(RoleId,RoleName)

Right join the both collections and databind the itemsource to datagrid.

Vs C++

$
0
0
Hello Dear....
 How to create pdf file......? pls sent me link...

Windows Server 2012 Backup and Restore Instructions Step by

$
0
0
I am trying to locate a step by step instruction for the Backup and Recovery procedures using external drives, includes Screenprints for Windows Server 2012.  Can anyone tell me where I can find this?

Form to a Word Document Template

$
0
0
I have a project that I've been working on.  It's a grievance application.  I've already designed the application on a tab control, but now they want to have spell check and be able to email the file.  I have done some research and thought that a word template for the application would probably work the best.  Is there any way to change the design I already have into a word template?

Is I-Phone is good for career if i have .net developer.please give me some advice

$
0
0
Is I-Phone is good for career if i have .net developer.please give me some advice.

place desktop icon in metro style app

$
0
0

Hi,

I would like to know how to place an icon in metro style app using C#.

 

Field suggestion

$
0
0
i am student of BS(IT) 8th semester , which field should i adapt development,database,networking
Viewing all 32060 articles
Browse latest View live