|
Supposing you want use C# to write your program, it seems that you are a little bit confused: do you want pickup the A tone (La 440Hz) with microphone or you want your speakers play a sinusoidal 440Hz tone?
But anyway why don't you start using search engines? Googling you'll find many open source programs that do that.
One from FFT Guitar Tuner from Codeproject[^], or this from Sourgeforge[^]...
|
|
|
|
|
|
Currently we're using in code <System.Web.Services.WebService(Namespace:="https://ourservice/")> to set the namespace, can this be done in web.config, instead? I've looked but can't find where?
VS2008, ASMX web service.
|
|
|
|
|
|
|
When I add an item to the datagridview (from another form), it shows up just fine. But when I try to add another item to the datagridview, only the new item appears, and the previous one gets thrown out, it appears.
Note that I'm using .Hide, and .Show, to move between two forms (add_form and main_form). I've tried using .ShowDialog to see if it would fix the problem, but instead I get multiple instances of the same window open after moving back and forth between forms.
How can I fix this problem?
Here is the code that adds to the DGV:
private void add_Click(object sender, EventArgs e)
{
invmain invmainobject = new invmain();
switch(combobox1.SelectedIndex)
{
case 0:
invmainobject.datagridview1.Rows.Add(itembox.Text, quantitybox.Text);
break;
case 1:
invmainobject.datagridview2.Rows.Add(itembox.Text, quantitybox.Text);
break;
case 2:
invmainobject.datagridview3.Rows.Add(itembox.Text, quantitybox.Text);
break;
case 3:
invmainobject.datagridview4.Rows.Add(itembox.Text, quantitybox.Text);
break;
default:
MessageBox.Show("Please select a category.\t\t");
combobox1.Focus();
return;
}
invmainobject.Show();
this.Close();
|
|
|
|
|
I suspect your problem has nothing to do with adding items to the datagrid, but everything to do with how you're handling the forms that contain/manipulate the grid:
Quote: but instead I get multiple instances of the same window open after moving back and forth between forms.
You have to show the code that is creating/showing these forms as you are probably creating new instances of the forms instead of managing the existing forms properly.
|
|
|
|
|
Here is the code for the main page where the tab control is, with the four DGV's:
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 WindowsFormsApplication1
{
public partial class invmain : Form
{
public invmain()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
cover form1 = new cover();
form1.Show();
this.Hide();
}
private void button2_Click(object sender, EventArgs e)
{
additem form1 = new additem();
form1.Show();
this.Hide();
}
private void deletebutton_Click(object sender, EventArgs e)
{
DialogResult deleteitem = MessageBox.Show("Delete selected item?\t\t\t", "Delete Item", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (deleteitem == DialogResult.Yes)
{
foreach (DataGridViewRow item in this.datagridview1.Rows)
{
datagridview1.Rows.RemoveAt(item.Index);
}
foreach (DataGridViewRow item in this.datagridview2.Rows)
{
datagridview2.Rows.RemoveAt(item.Index);
}
foreach (DataGridViewRow item in this.datagridview3.Rows)
{
datagridview3.Rows.RemoveAt(item.Index);
}
foreach (DataGridViewRow item in this.datagridview4.Rows)
{
datagridview4.Rows.RemoveAt(item.Index);
}
MessageBox.Show("Item deleted.\t\t\t", "Delete Item", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
And here is the additem page, where after clicking add, the item and quantity should be added to the appropriate DGV after selecting a valid category:
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 WindowsFormsApplication1
{
public partial class additem : Form
{
public additem()
{
InitializeComponent();
datetimelabel.Text = DateTime.Now.ToString("MM/dd/yyyy");
this.quantitybox.KeyPress += new KeyPressEventHandler(quantitybox_KeyPress);
}
private void additem_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
invmain form1 = new invmain();
form1.Show();
this.Hide();
}
private void quantitybox_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !(char.IsDigit(e.KeyChar) || e.KeyChar == '\b');
}
private void add_Click(object sender, EventArgs e)
{
invmain invmainobject = new invmain();
switch(combobox1.SelectedIndex)
{
case 0:
invmainobject.datagridview1.Rows.Add(itembox.Text, quantitybox.Text);
break;
case 1:
invmainobject.datagridview2.Rows.Add(itembox.Text, quantitybox.Text);
break;
case 2:
invmainobject.datagridview3.Rows.Add(itembox.Text, quantitybox.Text);
break;
case 3:
invmainobject.datagridview4.Rows.Add(itembox.Text, quantitybox.Text);
break;
default:
MessageBox.Show("Please select a category.\t\t", "Required Field Missing", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
combobox1.Focus();
return;
}
if (string.IsNullOrWhiteSpace(this.itembox.Text))
{
MessageBox.Show("The 'Item' field is required.\t\t\t", "Required Field Missing", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
itembox.Focus();
return;
}
if (string.IsNullOrWhiteSpace(this.quantitybox.Text))
{
MessageBox.Show("The 'Quantity' field is required.\t\t\t", "Required Field Missing", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
quantitybox.Focus();
return;
}
invmainobject.Show();
this.Close();
}
private void button1_Click_1(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
if (open.ShowDialog() == DialogResult.OK)
uploadpic.Image = Bitmap.FromFile(open.FileName);
}
}
}
Note that I'm no longer using .ShowDialog(), because of the trouble of multiple forms I got.
modified 27-Feb-15 18:16pm.
|
|
|
|
|
OK, a few things. First, you haven't solved the problem of multiple forms. You've just hidden them and never reusing the them. You're creating a new instance of every form on every button click, even your MAIN FORM!!
You're using the default names for all of your controls. DON'T! I have no idea what "button1" does and, in a years time, neither will you. Always give your controls and variables meaningful names.
If these two button controls on your main form with the grids and just there to get data from the user to add to the grid, you should create an instance of the data entry form and show it with ShowDialog. When the user clicks OK on that form control will return to the line right after the ShowDialog call. You can then get the data from that form, put it in your grids, then Dispose the form.
Next, when you go and clear all the rows from your datagrids, you don't need loops to delete each row from the girds. Look at the documentation for the Rows collection. There's a Clear() method on it. Call that and you wipe out every row in your datagrid in a single line of code.
|
|
|
|
|
I don't understand what I should change so that it would keep adding to the DGV (or any DGV, based on the category selected), and not deleting previous entries...
NOTE: this is only my first week of programming
|
|
|
|
|
This is your first week of programming and you've got data grids and new forms and stuff? Yeah, WAY over your head. Talk about jumping into the deep end of the pool without knowing how to swim.
Dim entryForm As New EntryForm
Dim result As DialogResult = entryForm.ShowDialog()
If result = DialogResult.Ok Then
whatever = entryForm.WhateverTextBox.Text
End If
entryForm.Dispose()
You don't put any code on the data entry form to switch back to the original main form. NONE AT ALL.
|
|
|
|
|
No, not really. C# is a pretty straightforward language; it's just this small hiccup I've run into.
How do I make it switch back to the original form?
|
|
|
|
|
Nothing. You put a button on your form, give it any text you want, like "OK", and then set the forms AcceptButton property to that button.
Well, there is one line of code you have to put into the Click event handler for that button:
Me.DialogResult = DialogResult.OK
That's it.
|
|
|
|
|
Hi,
Is there a way to automate (is it exposed) Lync loading a meeting url, the way that Outlook does when you click the link inside of the meeting and it calls Lync and opens the meeting?
Lync 2013 and Outlook 2010 and C sharp.
I've been looking through the Lync SDK and I haven't found any examples of this. I have the Lync url from Exchange already, I only need to know how to pass it to Lync and get Lync to spawn a meeting with it.
Thanks
|
|
|
|
|
turbosupramk3 wrote: the way that Outlook does when you click the link inside of the meeting Outlook sends me a clickable link; right click on the link and select "copy hyperlink". Next, shellexecute the link.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks Eddy, I figured out that it actually tries to use IE first, so I was able to mimic the same behavior with the following code
if (lyncUrl != "")
{
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe", lyncUrl);
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
}
else
{
MessageBox.Show("Lync url is blank or non existant");
}
|
|
|
|
|
turbosupramk3 wrote: I figured out that it actually tries to use IE first Weird, I had expected that it would use whatever browser would be the default.
Anyway, glad it works
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
hi Boys i read more about audio finger print and goggled more about this field
but resources is limited and found more companies that make this service but matching data on there servers and no open source algorithm or Library to make this ...
i have some body called (Advertisement Provider) and he pay money for some TV station to aired his advertisement content and he need application to identify if the TV station aired his advertisement or not ....
so after searching more ... i get that the technology that can make it called (Audio Finger Print) so i need help for this :
1- need the logic that can be used to get our goals (identify the advertisement content on TV station online streaming) need ideas please .
2- need some open source libraries can use it on C# i don't need online service that create the fingerprint local and sent it to their server to find matching i need all local with support of database .
thanks for every body for help ...
|
|
|
|
|
Shouldn't this be the type of thing you're discussing with your client? Coming up with ideas for the identification is really something you should discuss with the client. I guarantee that they will have ideas about how they want this tracking - it's called gathering requirements.
|
|
|
|
|
Thanks man for your replay
but i need more ideas just it ....
|
|
|
|
|
Hello,
I get a data stream, which I write continuously via a FileStream object as a .csv . Now, however, it is necessary that I need to search this stream to redirect the output to another file by date.
Question1: How can I parse stream by Date (either the IN or OUT Stream) ? (Stream to byte [] ??)
Question2: Can I create several StreamWriter-object to write to more files?
...switch (date)
case d1 => streamwriter1,
case d2: => streamwriter2
...and so on ...
The Code:
using (ReportResponse response = utilities.GetResponse())
{
using (var fileStream = new FileStream(fileName, FileMode.Append, FileAccess.Write))
{
response.Stream.CopyTo(fileStream);
}
}
Regards
Nicole
|
|
|
|
|
Most of the question doesn't mean anything: we have no idea what format your incoming data is in (so the "Stream to byte [] ??" comment is not very helpful. And to help you parse data, we would need to know what the data looked like, and how you identify "relevant" sections (but you should be able to get that info from the source provider).
"Can I create several StreamWriter-object to write to more files?" is easier: Yes. Up to the limit on the system file handles, which varies from system to system (Linux for example only allows 64 per process by default)
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
there are comming rows like this (1 line)
78411422311 11123456319 2015-02-22 Search Network Google search Computers 2 0 0 0.0 0 1.0 0 -- 100.00%
|
|
|
|
|
So what's the problem?
If it's in lines, that's half the work done - then all you have to do is knock up a regex to parse it - which is pretty simple:
(?<Field1>\d+)\s+(?<Field2>\d+)\s+(?<Date>\d{4}-\d\d-\d\d)\s+(?<RestOfLine>.*)$ Will probably do it.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: (?<Field1>\d+)\s+(?<Field2>\d+)\s+(?<Date>\d{4}-\d\d-\d\d)\s+(?<RestOfLine>.*)$ really has a certain je ne sais quoi.
|
|
|
|