|
Hi
I Want To create an IVR (Interactive Voice Response) Application in C#
can anybody help me to find some source code or guide me to write that.
thanks
|
|
|
|
|
Hi,
I have the following code, which works perfect, when I makes af DataGridView with drag and drop (the code pass over the FakturaId to the new form, so I can make a select on this)
System.Data.DataRowView SelectedRowView;
fakturasystemDataSet.FakturaRow SelectedRow;
SelectedRowView = (System.Data.DataRowView)fakturaBindingSource.Current;
SelectedRow = (fakturasystemDataSet.FakturaRow)SelectedRowView.Row;
FakturaVis FakturaVisForm = new FakturaVis();
FakturaVisForm.LoadFakturaVis(SelectedRow.FakturaID);
FakturaVisForm.Show();
But now I have made my own dataset and adapter and I have some problems with the above code. I don't know, how I get the FakturaRow in intellisense (how I get this into the code, where I instansiate the dataset and the adapter)?
Is my dsView the same as, the system generated fakturaBindingSource?
My code where I instansiate the dataset and the adapters:
private void loadKundeFaktura()
{
//create a connection string to the access database
OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;
User Id=;Password=;
Data Source=" + myDB);
// Create the DataSet
ds = new DataSet("KundeFaktura");
// Fill the Dataset with Kunder, map Default Tablename
// "Table" to "Kunder".
da1 = new OleDbDataAdapter("SELECT KundeId, Navn, Adresse, Postnr, Byen,
Telefonnr, Mobilnr, EmailAdr, Noter FROM Kunder", cn);
da1.TableMappings.Add("Table", "Kunder");
da1.Fill(ds);
// Fill the Dataset with Faktura, map Default Tablename
// "Table" to "Faktura". ORDER BY FakturaID DESC
da2 = new OleDbDataAdapter("SELECT FakturaID, KundeID, Dato, BetalingsDato,
Betalt FROM Faktura ORDER BY FakturaID DESC", cn);
da2.TableMappings.Add("Table", "Faktura");
da2.Fill(ds);
// Establish the Relationship "RelOrdDet"
// between Kunder ---< [Faktura]
System.Data.DataRelation relOrdDet;
System.Data.DataColumn colMaster2;
System.Data.DataColumn colDetail2;
colMaster2 = ds.Tables["Kunder"].Columns["KundeId"];
colDetail2 = ds.Tables["Faktura"].Columns["KundeID"];
relOrdDet = new System.Data.DataRelation("RelOrdDet", colMaster2,
colDetail2);
ds.Relations.Add(relOrdDet);
// The DataViewManager returned by the DefaultViewManager
// property allows you to create custom settings for each
// DataTable in the DataSet.
dsView = ds.DefaultViewManager;
// Databinding for the Grid's
dgrKunder.DataSource = dsView;
dgrKunder.DataMember = "Kunder";
dgrFaktura.DataSource = dsView;
dgrFaktura.DataMember = "Kunder.RelOrdDet";
}
Kind regards,
simsen
|
|
|
|
|
I don't understand the question. Why do you need intellisense ? If you've passed the ID, you can request the data from the database, surely ? Otherwise, communication between forms typically happens with delegates, or is this ASP.NET ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
It isn't ASP.NET.
I have to pass the Id to another form.
Normally I would do it this way: I drag and drop a datagridview (AND use the Visual Studios wizard to make the connection and so on) into form1 and then I use the below code1 on a button, to pass the id with it.
But my problem is (I'm a very newbee), I tried instead of using the wizard to make my own connection to the database and put data into the datagridview. See code2.
Now I don't know what I shall do, to pass the id over to form2. On form2 I have som fields, which i also get from the database - but I cann't get them, don't have have the id.
Kind regards,
simsen
Code1:
System.Data.DataRowView SelectedRowView;
fakturasystemDataSet.FakturaRow SelectedRow;
SelectedRowView = (System.Data.DataRowView)fakturaBindingSource.Current;
SelectedRow = (fakturasystemDataSet.FakturaRow)SelectedRowView.Row;
FakturaVis FakturaVisForm = new FakturaVis();
FakturaVisForm.LoadFakturaVis(SelectedRow.FakturaID);
FakturaVisForm.Show();
Code2
private void loadKundeFaktura()
{
//create a connection string to the access database
OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;
User Id=password=;
Data Source=" + myDB);
// Create the DataSet
ds = new DataSet("KundeFaktura");
// Fill the Dataset with Kunder, map Default Tablename
// "Table" to "Kunder".
da1 = new OleDbDataAdapter("SELECT KundeId, Navn, Adresse, Postnr, Byen,
Telefonnr, Mobilnr, EmailAdr, Noter FROM Kunder", cn);
da1.TableMappings.Add("Table", "Kunder");
da1.Fill(ds);
// Fill the Dataset with Faktura, map Default Tablename
// "Table" to "Faktura". ORDER BY FakturaID DESC
da2 = new OleDbDataAdapter("SELECT FakturaID, KundeID, Dato, BetalingsDato,
Betalt FROM Faktura ORDER BY FakturaID DESC", cn);
da2.TableMappings.Add("Table", "Faktura");
da2.Fill(ds);
// Establish the Relationship "RelOrdDet"
// between Kunder ---< [Faktura]
System.Data.DataRelation relOrdDet;
System.Data.DataColumn colMaster2;
System.Data.DataColumn colDetail2;
colMaster2 = ds.Tables["Kunder"].Columns["KundeId"];
colDetail2 = ds.Tables["Faktura"].Columns["KundeID"];
relOrdDet = new System.Data.DataRelation("RelOrdDet", colMaster2,
colDetail2);
ds.Relations.Add(relOrdDet);
// The DataViewManager returned by the DefaultViewManager
// property allows you to create custom settings for each
// DataTable in the DataSet.
dsView = ds.DefaultViewManager;
// Databinding for the Grid's
dgrKunder.DataSource = dsView;
dgrKunder.DataMember = "Kunder";
dgrFaktura.DataSource = dsView;
dgrFaktura.DataMember = "Kunder.RelOrdDet";
}
|
|
|
|
|
How does form2 get created ? Surely it's from form1, in which case you can pass the ID through the constructor ?
The problem with all the wizard garbage in .NET 2.0 is that you can get so far, then you hit a brick wall and realise you do need to learn all the stuff the framework has been taking care of for you.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian
First thanks for helping me. I'm totally lost here, and I don't know what to do.
Yes I found out, I couldn't use the wizard to do the things I will. So no I'm leaning myself the hard way, by trying to make a program for my friend.
I think I use a constructer (if I understand the book I use correctly which means a constructor is when I make a "new" statement). See the below code.
I have to problems. I don't know how to get the Id from the datagridview I stand on. And then to pass that with the constructer.
If you want to see all the code etc, you can get it here: http://www.ansi-design.dk/ANSI.zip[^]
The button (constructer) I use to open the form2 with code:
private void btnFakturaVis_Click(object sender, EventArgs e)<br />
{<br />
<br />
<br />
<br />
FakturaVis FakturaVisForm = new FakturaVis();<br />
FakturaVisForm.Show();<br />
}
|
|
|
|
|
Ah... OK.
Now, any class has a constuctor which is auto generated and takes no parameters. To pass parameters, you need to write another constructor. So, you have this
class FakturaVis
{
public FakturaVis ()
{
}
}
That's a class with an empty constructor. This may not even be in your code, if it's not, it gets inserterted. If you want to force people to pass an int value over, do this:
class FakturaVis
{
private int ID;
private FakturaVis ()
{
}
public FakturaVis (int ID)
{
this.ID = ID;
}
}
The name you pass in does not have to be the same as the one you store, but if it is, this will allow you to scope it properly. I've made the default constructor private, as I can't stop it being generated, private stops it being used. Then I've added a constructor which I can pass the ID in to. Now when you call new, you need to pass that ID, and you now have it within your new class instance.
To get the ID, I assume you're responding to a row being selected, the datagrid will have a selected row property, and then you can access the columns by index or name.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank you very very much. That was exactly what I needed. Now I can pass my id to form2. And thank you for having the patient with a newbee like me, who doesn't know the correct way to explain myself.
Kind regards,
simsen
|
|
|
|
|
Glad to help. I'm self taught myself, which means I learned from asking in forums like these, myself.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi
can anyone tell me how a socket can be type cast into stream , is it possible.
thanks
|
|
|
|
|
Hi!
No, it's not possible.
A socket is a socket, a stream is a stream.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Socket is not a stream but you can get underlying stream of socket using this code:
NetworkStream ns = Socket.GetStream();
rizwanSharp;
|
|
|
|
|
I have been fooling around with unit-tests, and I was wondering if there is a good way to unit-test if events get fired properly? And is it wise to test these?
I think it's smart to test them, since you want to be as complete as possible when unit-testing.
WM.
What about weapons of mass-construction?
-- modified at 8:41 Sunday 23rd July, 2006
|
|
|
|
|
Yes its very easy atleast if you use .net 2.
you can do things like this:
public void MyTest<br />
{<br />
ClassToTest klass = new ClassToTest();<br />
bool eventFired = false;<br />
klass.SomeEvent += delegate { eventFired = true; };<br />
klass.DoStuff();<br />
<br />
assert.IsTrue(eventFired);<br />
}
This might look impossible at first sight since "eventFired" seems to be out of scope in the delegate.
However , the c# compiler is kind enough to do some magic for us , packing our bool in a dispatch class.
so it works very well and Im using it all the time.
//Roger
|
|
|
|
|
Duh, I did forget anonymous delegates existed
Thanks for the info, this should solve the problem.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi,
I want to let my programme run in some PC without FrameWork,so i want in my Install Project,Automatic check the system if FrameWork installed,if not,it can install it but not from internet,i want to intergrate it in my Install file,how can i did this?thanks for answers~~
|
|
|
|
|
There is no merge module for hte framework, you have to ship the framework installer and run it from your install program.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi.
I want to do some works with a picture and need to work with pixels.
but the getpixel(,),setpixel(,,) functions in a loop are very slow.
is there a way to get or set pixels faster.
my code is like this:
Bitmap myBmp = new Bitmap("filename");
Color p = new Color();
int i,j;
for(i=0 ; i < myBmp.Width ; i++)
{
for(j=0 ; j < myBmp.Height ; j++)
{
p = myBmp.GetPixel(i,j);
if(p.R <= 250) p.R += 5;
if(p.G <= 250) p.G += 5;
if(p.B <= 250) p.B += 5;
myBmp.SetPixel(i,j,p);
}
}
erfan
-- modified at 8:01 Sunday 23rd July, 2006
modified on Thursday, February 12, 2009 5:07 AM
|
|
|
|
|
Hi!
Just use the search function to find Christian Grauss' excellent articles on image processing.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
thanks
what is the article's name?
|
|
|
|
|
My answer was that there are articles here on CP telling you how to solve your problem, you just have to search!
If you're unable to find the search button, you can try this page instead.[^]
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
This[^] article is the first of several.
/ravi
|
|
|
|
|
1.i write a windows service,open a other application,but the process is run,application is not open,the same code in a winfrom project is not any question.the code of open other application is simple:
Process myProc = new Process();
myProc.StartInfo.FileName = strUrl;
myProc.StartInfo.CreateNoWindow = false;
myProc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
myProc.Start();
strUrl is other application's path,it's right!
2.how to write uninstall windows service code in setup project ,i know command "installutil servicename.exe" can uninstall windows service,but setup project can't use command,can you tell me how to write a unstall project and put the project into setup project's unstall custom action?
Thank you very much!
|
|
|
|
|
1. A windows service usually doesn't have access to the windows desktop and an application started by the service won't have access to the desktop, either.
Most likely this is the reason why the application is not running.
2. Add an Installer to your service, then you can run this Installer as a custom action during your uninstall.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
thank you!
i geted the answer of my second question:override Uninstall method in windows service projectinstaller.cs file,in this method write a process.start() ,process.fileName="path\\installutil.exe /u path\\serviceName",when application uninstall,the windows service will be uninstalled.
first question,i selected the serivce propety of "allow the windows desktop",but the application only run a process,have not desktop UI.
i will try and test again!
thank you again!!!
|
|
|
|
|