|
You're a long way off track. You'll be struggling to make it work doing it the way you are.
Examine the CheckedListBox source to see how Microsoft do it, then adapt that to your own needs. There's alot to learn to create such an advanced control - beyond the scope of a forum such as this until you get into more specific details IMO.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hello all,
I'm working on a program using MS SAPI 5 where people can have a verbal conversation with a virtual person. I know the general content of these conversations, so I could limit the dictation grammar, and hopefully get much better speech recognition. I just can't quite figure out how to limit the dictionary. Does anyone here know how to define a limited domain grammar in SAPI 5?
I'm using C#, here's the instantiation of my dictation grammar and recognizer:
System.Speech.Recognition.SpeechRecognizer _recognizer = new SpeechRecognizer();
DictationGrammar dictGrammarContext = new DictationGrammar("grammar:dictation");
dictGrammarContext.Name = "Contextual Dictation Grammar";
dictGrammarContext.Enabled = true;
_recognizer.LoadGrammar(dictGrammarContext);
_recognizer.SpeechRecognized += new EventHandler<speechrecognizedeventargs>(DictReco_Event);
_recognizer.SpeechHypothesized += new EventHandler<speechhypothesizedeventargs>(DictHypo_Event);
</speechhypothesizedeventargs></speechrecognizedeventargs>
Any kick in the right direction (even towards a more appropriate forum) would be appreciated.
|
|
|
|
|
Hi Guys, working on an app at the mo that has a db,
the thing is, is that at the moment the db is hard coded to point to c:\mydatabase.
but obviosuly what i want to do is deploy the app to the local os drive,
but how do i do this in code, and need to make sure in the code knows where to find the db.
|
|
|
|
|
Relative directorys, put your DB in your application folder and then use System.Windows.Forms.Application.ExecutablePath and it will point to the db.
|
|
|
|
|
EliottA wrote: put your DB in your application folder
NOOOOOOOOOOOOOOOOO!
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Not even if it's Access?
|
|
|
|
|
Hi Greeg, what do you recommend?
|
|
|
|
|
The easiest way I have found to deploy a database is to embed it in the assembly and then on first start check the application data directory for the file. If it doesn't exist write it using GetType().Assembly.GetManifestResourceStream("theEmbeddedName") which returns a stream that I save to a file.
The application data path is
System.Windows.Forms.Application.CommonAppDataPath
embed a file in an assembly is as easy as adding it the project and selecting Build Action:Embedded Resource.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
I suppose that partly depends on what database system is in use and what sort of environment it runs in. And whether or not other such databases are present.
In a corporate environment with "real" databases (i.e. not Access) there will likely be administrators to tell you where to stick it.
For home use you can pretty much do as you please, but try not to put it on a system ( C: ) drive.
modified on Saturday, January 24, 2009 12:50 AM
|
|
|
|
|
You can try to connect to your database, and if failed, open a connection dialog with this
If you are using an access datatable, it can be adapted for use an oledb connection.
Alex
|
|
|
|
|
Good afternoon.
I would like to create a Multi Column (2)ComboBox populated by existing (SQL) dataset.
The dataset returns the record ID and the item name (e.g. 1, "Apple"). The comboBox would display the item name, and the record ID would be hidden, but still "tied" to the item name.
Also I would like to reference the 1st colums to be used in another SQL statement.
I noticed a couple of examples (some with DataGrids), but they don't seem to suit our needs.
Thank you,
WHEELS
|
|
|
|
|
If you're returning two values but only want one displayed then you don't need a multi column combobox. You can use the standard one and set the DisplayMember and ValueMember properties to acheive exactly what you describe.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi DaveyM69.
I am very new to C#. More of a VBA master. I took C many moons ago, but am struggling a bit in C#.
I am vaugely familiar with the properties you mentioned, but how do I do what you suggest?
WHEELS
|
|
|
|
|
Assuming you're returning a DataSet from the database, set the ComboBox's DataSource to the Table you need in the DataSet. Set the ComboBox's DisplayMember to the column that has the text in that Table and the ValueMember to the column that has the ID.
That's all there is to it!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thank you Dave.
I beleive that should do the trick.
WHEELS
|
|
|
|
|
Hi Dave.
I have the following code:
ds = d.GeneralDropDown("Dept");
foreach (DataRow dr in ds.Tables[0].Rows)
{
//cboDeptID.Items.Add(dr[constrDeptID].ToString());
//cboDepartment.Items.Add(dr[constrDeptID].ToString() + " " + dr[constrDeptColumn].ToString());
cboDepartment.Items.Add(dr[constrDeptColumn].ToString());
cboDepartment.DisplayMember = dr[constrDeptColumn].ToString();
cboDepartment.ValueMember = dr[constrDeptID].ToString();
}
private void cboDeptID_SelectedIndexChanged(object sender, EventArgs e)
{
//ds = new DataSet();
//ds = d.FillDataGrid(this.cboDepartment,this.cboAcronym);
MessageBox.Show(this.cboDepartment.ValueMember);
MessageBox.Show(this.cboDepartment.DisplayMember);
}
Am I using the DisplayMemeber and ValueMember correctly? The combobox is poppulated, but the MessageBoxes don't come up when the value in the combobox changes.
Any ideas? WHEELS
|
|
|
|
|
There's no need to add your items in a loop, just assign the combo's DataSource to the DataSet's DataTable (ds.Tables[0]) and set the DisplayMember and ValueMember to the table's respective ColumnNames and that should fill the combo.
To get the value just get the combobox's SelectedValue. Working example below
void InitializeCombo()
{
DataSet ds = new DataSet();
ds.Tables.Add();
ds.Tables[0].Columns.Add("ID");
ds.Tables[0].Columns.Add("Display");
ds.Tables[0].Rows.Add(new object[] { 1, "One" });
ds.Tables[0].Rows.Add(new object[] { 2, "Two" });
ds.Tables[0].Rows.Add(new object[] { 3, "Three" });
ds.Tables[0].Rows.Add(new object[] { 4, "Four" });
ds.Tables[0].Rows.Add(new object[] { 5, "Five" });
comboBox1.DataSource = ds.Tables[0];
comboBox1.DisplayMember = "Display";
comboBox1.ValueMember = "ID";
comboBox1.SelectedIndexChanged += new EventHandler(
comboBox1_SelectedIndexChanged);
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show(comboBox1.SelectedValue.ToString());
}
P.S. There's no need for all the x.ToString()s that you have everywhere!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thank you Dave.
I greatly appreciate you help.
WHEELS
|
|
|
|
|
No problem, that's what's these forums and all the users are here for
Any more problems, just post back.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Did you get it working OK?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi Dave.
I am on a differwnt project, but we experiment with the code using the dataset from the DAL layer next Wednesday.
Have a great weekend,
DAVE
|
|
|
|
|
Hi Dave.
Finding it challenging to get it working.
I have a form with a comboBox and the following code:
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;
using System.Data.OleDb;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
const string constrLetterColumn = "Letter";
const string constrDeptID = "DeptID";
const string constrDeptColumn = "Department";
const string constrExpandColumn = "Expansion";
DAL d = new DAL();
DataSet ds;
DataTable dt;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
void InitializeCombo()
{
// Constructing data set in code, obviously this would come from your DAL
DataSet ds = new DataSet();
ds.Tables.Add();
ds.Tables[0].Columns.Add("ID");
ds.Tables[0].Columns.Add("Display");
ds.Tables[0].Rows.Add(new object[] { 1, "One" });
ds.Tables[0].Rows.Add(new object[] { 2, "Two" });
ds.Tables[0].Rows.Add(new object[] { 3, "Three" });
ds.Tables[0].Rows.Add(new object[] { 4, "Four" });
ds.Tables[0].Rows.Add(new object[] { 5, "Five" });
// the next three lines fill your combo and set the members
comboBox1.DataSource = ds.Tables[0];
comboBox1.DisplayMember = "Display";
comboBox1.ValueMember = "ID";
// subscribe to SelectedIndexChanged event
comboBox1.SelectedIndexChanged += new EventHandler(comboBox1_SelectedIndexChanged);
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show(comboBox1.SelectedValue.ToString());
}
}
}
Where am I going wrong?
WHEELS
|
|
|
|
|
HI Dave.
I had a coworker work with me on the code.
It works well.
When I cut and pasted some code from another project, it didn't work because I was missing an event handler.
Thank you,
DAVE
|
|
|
|
|
Cool - glad to help
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hello all, sometimes the easiest things are the things you oversee the most.
I have an application, it's generally finished so-to speak. Now all that's left is just general cosmetics. My question lies herein; I have a splash screen. I want to put a progress bar on it to keep the user occupied while initialization and connections are established. My question is, how would I upgrade the progress bar so it actually reflects true progress of loading? This includes downloading tables from MySQL DB (and establishing a connection), loading RSS feeds etc.
How would you go about it, AFAIK there isn't a callback to determine how much data from a table has been loaded or how many feeds out of x have been downloaded.
Direction?
|
|
|
|