dimanche 1 mars 2015

Visual studio 2013 does build but do not run the solution

I'm working on my school project and hit on problem with Visual studio 2013... I created a clr project and added windows form and entry point as supposed but after building the project successfully it doesn't run it and gives me an error "system cannot find the file specified"... but when I try to run currently built .exe it works perfectly...


Any idea why the debugger cannot open the file?


Access Query Running Subtraction

I'm working on a project, in which I need to calculate all the due payment and to show in DataGridView. I've made a query in Query Design. But I'm unable to make query to get total, paid amount, due amount. Here is the query:



SELECT Payment.PayDate, OrderMaster.OrderId, OrderMaster.CustomerName, OrderMaster.TotalAmount, Payment.PayAmount, OrderMaster.TotalAmount - Payment.PayAmount AS DueAmount FROM OrderMaster INNER JOIN Payment ON OrderMaster.OrderId = Payment.OrderId;


I'm getting the query result like this:



PayDate | OrderId | CustomerName | TotalAmount | PayAmount | DueAmount
-------------------------------------------------------------------------
20/12/2014 | 1 | Someone | 5000 | 2000 | 3000
22/12/2014 | 1 | Someone | 5000 | 1000 | 4000
25/12/2014 | 1 | Someone | 5000 | 2000 | 3000


I want the query result like this:



PayDate | OrderId | CustomerName | TotalAmount | PayAmount | DueAmount
-------------------------------------------------------------------------
20/12/2014 | 1 | Someone | 5000 | 2000 | 3000
22/12/2014 | 1 | Someone | 5000 | 1000 | 2000
25/12/2014 | 1 | Someone | 5000 | 2000 | 0


Please help me to make the exact query to get this result. Thanks.


c# Implement Speech In Noise

I have 2 audio files and With them I want to implement speech in noise i.e speech with a background noise. One audio file is for background and the other for speech. The SNR should be +10dB. Both are WAV types. It is a c# windows forms project. I have been trying to find the code to achieve this since a long time but have had no success. Any suggestions?


How to move caret in a textbox C#

I have a Window Form Application and I am making a virtual Keyboard. Using the arrow keys (Up, Down, Left, Right) I need to move the caret in the textbox. I have searched on it and found SelectionStart, but I dont think it can be of any use in this case.


Any Help?


SynchronizationContext is null in winforms

I'm creating a library which relies on capturing the SynchronizationContext in order to post callbacks back to the UI thread.


A user was having a weird condition where the callbacks were being posted to the ThreadPool instead. After investigating a bit, I came up with the following two test cases:


1:



public partial class Form1 : Form
{
private Test test;

public Form1()
{
test = new Test();
InitializeComponent();
}

private class Test
{
public Test()
{
if (SynchronizationContext.Current == null)
throw new InvalidOperationException("It's null! :(");
}
}
}


2:



public partial class Form1 : Form
{
private Test test = new Test();

public Form1()
{
InitializeComponent();
}

private class Test
{
public Test()
{
if (SynchronizationContext.Current == null)
throw new InvalidOperationException("It's null! :(");
}
}
}


The 1st test runs fine, but the 2nd one throws an exception. Why?


Picturebox resize rectangles/ellipse in a group

I got a question about resizing in a picturebox.


I got a paint program where i can make rectangles and ellipse and also i can make a group of rectanges/ellipse.


My problem is when i want to resize a group all the objects also need to be resized(those objects got variables PointF, SizeF).


So can anyone help me with this problem?


ps sorry i cant post images.


index was out of range. I can't figure out why

I am making a search bar for my windows form application. I have datagridview, textbox and a combobox...


I have this code in my class :



Classes.dbConnect _db = new Classes.dbConnect();

public void SearchPosition()
{
if (_search.Equals("POSITION"))
{
_db._conn.Open();
string com = "SELECT * FROM tbl_Candidates" + " WHERE ( Position LIKE @pos )";
_db._com = new SqlCommand(com, _db._conn);
_db._com.Parameters.AddWithValue("@pos", "%" + _position + "%");

try
{
_db._da = new SqlDataAdapter();
_db._da.SelectCommand = _db._com;
DataTable _dt = new DataTable();
_db._da.Fill(_dt);
BindingSource bs = new BindingSource();
bs.DataSource = _dt;
_dg.DataSource = bs;
_db._da.Update(_dt);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
_db._conn.Close();
}
}
}


Then I have my textbox = TxtSearch.Text



private void txtSearch_TextChanged(object sender, EventArgs e)
{
Classes.Admin.Candidates.position = txtSearch.Text;
cand.SearchPosition();
}


And i have my combobox = cboCategory; Item inside is "Position"



private void cboCategory_SelectedIndexChanged(object sender, EventArgs e)
{
Classes.Admin.Candidates.search = cboCategory.Text;
}


When I start typing in my TxtSearch.Text. Every letter searches the database with the same value as the TxtSearch.Text.


The DataGridView only shows the value same as the value in the textbox. But when the datagridview is empty already, i keep getting the error.


"index was out of range. Must be non-negative and less than the size of the collection. Parameter name: Index"