|
..might not even be implemented in the device-driver. What makes you think one can play a sound through a recording-device?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I want develop an sound player.
When i speak from Skype (example) or other call apps, I want to listen sounds or music from my application
|
|
|
|
|
|
Thanks for your answer.
USB Microphone is an good idea.
I'll try to create it
|
|
|
|
|
You're welcome.
Emulators are great for demoing hardware dependent apps when it's not practical to haul everything around.
|
|
|
|
|
Ok, so I am at work but just couldn't wait to figure out what I am doing wrong so I am going to try to post this from my phone without my code in front of me.
I have a form and on the form I need the user to select a bit of data, so I am using showDialog (myPopup);
Then in the popup I have the user select said data from a list.
Then when they push the "confirm" button I do this in the on click method:
MainForm MF = new MainForm ();
MF.sendData (data);
this.Close();
Then back in MainForm in sendData() I want to be able to make a label that I have hidden: myHiddenLabel.Text = "data received";
However, this is where I hit a snag, it will not update the label?
Now when I tested and used a MessageBox.Show("test"); in the sendData() method it worked, but for some reason nothing on the MainForm will update for me?
Any ideas?
PLEASE NOTE: this was written off memory and on a phone so Gramm iCal errors and code that doesn't look gramma calluses correct is probably just a victim of autocorrect..
Sorry,
Thank you
|
|
|
|
|
|
My crystal ball is clouded-over, but, in general, you should not be creating a "new" MainForm ... if MainForm is the Form that used 'ShowDialog to put up the instance of your Data Form.
Every time you create a new MainForm with 'new ... .unless you have somehow kept a reference to the previous instance of MainForm ... you have discarded your reference: while that instance of the MainForm and any data the user entered on it, or state it maintains, is still there in memory, you have no way to access it.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
No.
As Bill says, you don't create a new instance, particularly if you want the data to go to the original main form.
Create a property in your popup:
public string Data { get; private set; } And set the value of Data in the button Click handler method. Make the button have a DialogResult value of OK, and the system will close the popup for you.
Then in your main form:
MyPopup mp = new MyPopup();
if (mp.ShowDialog() == DialogResult.OK)
{
string data = mp.Data;
...
} Will sort it all out for you.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
This was it exactly, Thank you to all that helped! problem solved!
Thank you guys!!!
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I want to get notified when my System.Windows.Forms.UserControl class is unselected. i.e. when another form is selected. I am using VisibleChanged to tell me when it is selected and that works. But it doesn't fire when the form is unselected. I have tried the following events:
ControlRemoved
Leave (Focus)
Does anyone know if there is an event for that?
|
|
|
|
|
You should be using the Activated event to tell when a specific form is brought forward and activated. That's the intended way to accomplish what you're trying to do.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
0. suggest you put a Public Property in the UserControl code to track whether the Control is Visible and Active:
public bool HiddenOrLeft { set; get; }
Update that variable using the various EventHandlers described here:
1. use the 'VisibleChanged Event of the UserControl to detect when it is hidden.
2. use the 'Leave Event of the UserControl to detect it loses Focus on the Form it is sited in.
3. use the 'Enter Event of the UserControl to detect it becomes active/has focus.
4. use the Form 'Leave Event to also set the flag that indicates the UserControl is not active.
You want to go "whole hog:" also handle the /Form.Deactivated Event and the Form 'VisibleChanged Event
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
I am new to C# and I am planing to design my own keypad but I don't know how/where to start, I have 4 textBoxes the keypad buttons.
The first problem came into my mind was: how can I detect the cursor location (which textBox is the cursor in?).
So for example if I had only one textbox then it is easy I could write inside button1 : textBox1.text = "1" and inside button2 : textBox1.text = "2" and inside button_A : textBox1.text = "A".... and so on but I have 4 textBoxes and it is confusing.
Can you please provide me with an idea or what to write inside each button to print its value in the textbox which the cursor is in.
Thank you professionals.
|
|
|
|
|
edit #1
All you need to do to keep the Focus on the TextBox Control when a Button is clicked is to set the TextBox 'Capture property to 'true in the Click EventHandler. Example:
private void button1_Click(object sender, EventArgs e)
{
CurrentTextBox.Text += "A";
CurrentTextBox.Capture = true;
} See below for how to keep the 'CurrentTextBox field up to date as the user changes which TextBox they use.
end edit #1
The word "keypad" suggests to me a bunch of Buttons that you click on, and things happen.
I am not clear what you are doing with the TextBoxes here; please clarify.
In WinForms the 'ActiveControl property of the ContainerControl Class will always return which Control has Focus in the ContainerControl (which could be Form, a Panel, etc.) [^].
Control activeFormControl = this.ActiveControl;
Control activePanelControl = panel1.ActiveControl;
A way I often use to keep track of which of several TextBoxes has Focus currently, or has had Focus most recently is: wire all of them up to the same 'Enter EventHandler, and:
TextBox CurrentTextBox;
private void TextBoxes1To4_Enter(object sender, EventArgs e)
{
CurrentTextBox = sender as TextBox;
if(CurrentTextBox == null)
{
throw new ArgumentNullException("Illegal use TextBox Enter");
}
switch (CurrentTextBox.Name)
{
case "textBox1":
textBox1.Text = "Entered";
break;
case "textBox2":
break;
case "textBox3":
break;
case "textBox4":
break;
}
}
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
modified 14-Nov-15 3:56am.
|
|
|
|
|
Clicking the button will cause the cursor to leave any textbox it is in.
You can determine which textbox the cursor is in (or "was" in) by hooking up the "Leave" event for each textbox and storing the "sender" (i.e. textbox) for each event in a common field / property. (Note that all the textboxes can use the same event handler). e.g.
private TextBox _tb = null;
this.textBox1.Leave += new System.EventHandler(this.textBox_Leave);
this.textBox2.Leave += new System.EventHandler(this.textBox_Leave);
this.textBox3.Leave += new System.EventHandler(this.textBox_Leave);
private void textBox_Leave( object sender, EventArgs e ) {
_tb = sender as TextBox;
}
private void button1_Click( object sender, EventArgs e ) {
if ( _tb != null ) {
MessageBox.Show( "The last TextBox was: " + _tb.Name );
}
}
(The "Enter" event can be used to record where the cursor currently is as long as there is no other UI activity that will move the cursor; i.e. a button click).
|
|
|
|
|
Hi
If You are new to C# it wont be easy.
First of all You can not use buttons, because when You click a button that button will steal focus, so your key stroke will have no notion where to go.
The only (winforms)control that not steals focus is a label, but a label has not got the right properties to act as a key.
The solution is to create a custom control derived from label control.
to do so You must add this class to your project:
namespace YOURPROJECTNAMESPACE
{
public sealed class MyControl : Label
{
public MyControl()
{
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
BackColor = Color.Transparent;
}
public Image ControlImage { get; set; }
protected override void OnPaint(PaintEventArgs e)
{
if (ControlImage != null)
{
e.Graphics.DrawImage(ControlImage, 4, 4, Width - 8, Height - 8);
}
var rectangle = new RectangleF(2, 0, Width, Height + 5);
var format = new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Center
};
e.Graphics.DrawString(Text, Font, Brushes.Black, rectangle, format);
}
}
}
After you have done this You will find in the designer toolbox MyControl.
Then drag a flowLayouPanel from the toolbox. Populate this panel by dragging as many MyControls as you need. in properties give them a nice picture of a key and a character as text.
One more thing to do, In the designer doubleclick each key,and in the click event this:
private void myControl1_Click(object sender, EventArgs e)
{
SendKeys.Send("{1}");
}
private void myControlEnter_Click(object sender, EventArgs e)
{
SendKeys.Send("{ENTER}");
}
Etc.
If You have any more questions just ask,
Groover
0200 A9 23
0202 8D 01 80
0205 00
modified 13-Nov-15 21:47pm.
|
|
|
|
|
Well, it can be easy: all you need to do to keep the Focus on the TextBox Control when a Button is clicked is to set the TextBox 'Capture to 'true in the Click EventHandler.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
hello people i have studied a network sniffer on this site <a href="http://www.codeproject.com/Articles/17031/A-Network-Sniffer-in-C"> </a>[<a href="http://www.codeproject.com/Articles/17031/A-Network-Sniffer-in-C" target="_blank" title="New Window">^</a>] so how can i do the reverse which is creating the packet in c# or vb.net pcap seems not to work
thank you
|
|
|
|
|
1. I suggest you post on the article itself
2. You may have pasted the link wrongly, since we can't click it
Best,
John
-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!
|
|
|
|
|
Crafting packets from scratch can only be done by administrators. I you're trying to do this as a normal user, it's never going to work. Why? Security reasons.
|
|
|
|
|
i working on a NAT project of mine .i can receive packtes and get the info such as source ip and dest ip but i need to do the reverse by creating a packet and im an administartor by the way
|
|
|
|
|
|
I have object with members of different types like this:
public class Node
{
public int itemID = -1;
public int counter = 1;
public Node parent = null;
public List<Node> childs = new List<Node>();
public Node nodeLink = null;
}
And I have class tree
public class tree
{
public List<int> headerList = null;
public Dictionary<int, Node> mapItemNodes = new Dictionary<int, Node>();
public Dictionary<int, Node> mapItemLastNode = new Dictionary<int, Node>();
public Node root = new Node();
}
And I need your help to serialize and deserialize an object of the class tree
|
|
|
|