|
Can you return the number of these collections from the database? Get a second resultset from your query and use it to populate the treeview.
|
|
|
|
|
Populate the treenode by issuing a select that returns COUNT and put that number in the node.
|
|
|
|
|
What is the best way to return more than one value back from a method?
I have a method that I'm calling that I want to return back some data, a primary key, and the datetime stamp. I was thinking of returning a struct back, but was wondering if there was a better way?
Tom
|
|
|
|
|
A struct or some out variables on the signature, depending on if the struct makes any sort of sense beyond being a way to return the values.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You can also use "out" paramaters, which let you pass information back as a write only variable.
private string ReturnStuff(out var1, out var2)
{
var1=something;
var2=something;
return primaryKey;
}
Note these are Write-Only variables.
Aaron
|
|
|
|
|
Hi,
i need to display the selected folder name from a browse folder dialog on clicking "ok" button in another dialog in a text box,the user should not be able to edit this, i have disabled the text box on creation itself.Please help me with the code since i have to deliver my application by tomorrow evening.
Awaiting ur replies
Thanks
Shruthi
|
|
|
|
|
To pass info between forms, use a delagate.
x2pca wrote: Please help me with the code since i have to deliver my application by tomorrow evening.
That's very troubling.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Indeed. Asking for answers without try does not benefit students at a long run. It looks like a side effect of forum.
Best,
Jun
|
|
|
|
|
Hello guys, Jun, Christian
Well, why don't we help the newbies with code snippets? This would encourage them, and give them a head start, wouldn't it?
I mean.. Is it "cheating" if we help them with a line or two, just as an assistance in their projects? I don't endorse it as a habit, yet I think they sometimes deserve more help than mere general guidance don't you agree?
Regards
|
|
|
|
|
Yes, by all means. We should help those who have tried, not those who just pass the assignment to us.
Best,
Jun
|
|
|
|
|
Well, it sounds fair enough for me.
Thanks Jun.
Regards
|
|
|
|
|
x2pca wrote: Please help me with the code since i have to deliver my application by tomorrow evening.
Yeah right!!
If you're a student, get used to the fact that nobody is going to do your job for you. Nobody.
If you are already in the industry, why have you not figured that out yet?!?!?!?!?!
Good luck. The clock is ticking...
:josh:
My WPF Blog[^]
|
|
|
|
|
hi,
I create a dataset and fill it with access database. everything is fine, I can see the data in the binded grid control. but i have an exception when I do the copy operation. the exception says, the dataset can not pass the constrains (non null, foreign key...).
I think I can not create the first dataset if the data is wrong?
does anyone have idea about this?
Thanks a lot!
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
DataTable has two methods, BeginLoadData and EndLoadData, which can be used when copying data into the table to prevent constraints from being enforced temporarily. Try using those when copying the data.
:josh:
My WPF Blog[^]
|
|
|
|
|
I am coding a interest calculator in C# using Visual Studio 2005 Express edition and I keep on getting the following error: "CalcBalance does not exist in the current context". I am not sure what's cuasing it or how to fix it. Any advice which would help in get this code working would be greatly appreciated. Below is the full code:
<%@ Control Language="C#" ClassName="WebUserControl" %>
protected void Button1_Click(object sender, EventArgs e)
{
Label6.Text = "Final Balance: $" +
CalcBalance(Convert.ToInt32(TextBox1.Text),
(Convert.ToInt32(TextBox2.Text) / 100),
Convert.ToInt32(TextBox3.Text),
Convert.ToInt16(DropDownList1.SelectedItem.Value)).ToString();
}
private string CalculateBalance(int Principal, double Rate, int Years, int Period)
{
double result;
double NumToBeRaised = (1 + Rate / Period);
result = Principal * System.Math.Pow(NumToBeRaised, (Years * Period));
return (result.ToString("C"));
}
<asp:label id="Label1" runat="server" style="position: relative" text="Compound interest Calculator" width="318px" font-bold="True" font-size="Large">
<asp:label id="Label2" runat="server" style="position: relative" text="Principal ($)" width="165px">
<asp:textbox id="TextBox1" runat="server" style="position: relative">
<asp:label id="Label3" runat="server" style="position: relative" text="Rate (%)" width="165px">
<asp:textbox id="TextBox2" runat="server" style="position: relative">
<asp:label id="Label4" runat="server" style="position: relative" text="Years:" width="165px">
<asp:textbox id="TextBox3" runat="server" style="position: relative">
<asp:label id="Label5" runat="server" style="position: relative" text="Compound Frequency:" width="165px">
<asp:dropdownlist id="DropDownList1" runat="server" style="position: relative">
<asp:listitem value="1">Annually
<asp:listitem value="4">Quarterly
<asp:listitem value="12">Monthly
<asp:listitem value="365">Daily
<asp:listitem>
<asp:button id="Button1" runat="server" style="left: 9px; position: relative; top: 10px"
="" text="Calculate" width="207px" onclick="Button1_Click">
<asp:label id="Label6" runat="server" style="position: relative" width="165px">
Greg
The Belizean Dan Dada!!!
|
|
|
|
|
Are you kidding?
You are calling a function named CalcBalance but you have defined one with the name CalculateBalance . Do you see the difference?
|
|
|
|
|
protected void Button1_Click(object sender, EventArgs e)
{
Label6.Text = "Final Balance: $" +
CalcBalance(Convert.ToInt32(TextBox1.Text),
^^^^^^^^^^^ -- LOOK AT WHAT YOU TYPED HERE :~
(Convert.ToInt32(TextBox2.Text) / 100),
Convert.ToInt32(TextBox3.Text),
Convert.ToInt16(DropDownList1.SelectedItem.Value)).ToString();
}
private string CalculateBalance(int Principal, double Rate, int Years, int Period)
^^^^^ - NOW LOOK AT WHAT YOU TYPED HERE :omg:
{
double result;
double NumToBeRaised = (1 + Rate / Period);
result = Principal * System.Math.Pow(NumToBeRaised, (Years * Period));
return (result.ToString("C"));
}
|
|
|
|
|
By looking at your code, it seems as CalculateBalance(...) is the function that actually calculates the interest but you are using CalcBalance instead of CalculateBalance(...) as the name of the function.
If the name of the interest calculating function is actually CalcBalance, then this error might be because CalcBalance is not in the current class.
Regards,
Wasif Ehsan
|
|
|
|
|
wasife wrote: If the name of the interest calculating function is actually CalcBalance, then this error might be because CalcBalance is not in the current class.
"this error might be..." You are too kind, Wasif
:josh:
My WPF Blog[^]
|
|
|
|
|
Thanks, Guys I really apprecaite the tip. I changed the name and it worked. This code was written directly from a microsoft book, as is, so i took it for granted that i was doin something wrong................what a dork. Thanks again. I knew I can rely on you guys for assistance.
Greg
The Belizean Dan Dada!!!
|
|
|
|
|
Which just goes to proove:
1) Technical writers/editors make mistakes too
2) Dont believe everything you read without verifying it
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Hi, i'm trying to show the "video capture filter" or "video source" form to configure the webcam parameters.
How can i do that??
Very thanks. Sorry, I'm Spanish.
www.studios-tortuga.com
|
|
|
|
|
You probably should begin by reading Chris' article on how to get answers to your questions. It is really unclear as to what you are asking here! If you believe there is some kind of dialog in .NET to display this video source form, you are very wrong. You will have to write this yourself. If it is a feature within a webcam piece of hardware, then you need to look into the webcam SDK and determine how to interact with this in your program. Contacting the webcam manufacturer will help along these lines.
|
|
|
|
|
It's ok to be Spanish. Don't apologise. Now, if you were Welsh....that's a different question.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
I’m having troubles with the following code:
txtSelect.Text = “Select System_id From [DFIParmsHTS].[docsadm].[ExtGroup] where CustNumber = _CustomerNumber”
OdbcCommand cmdSelect= new OdbcCommand(txtSelect.Text, conn);
cmdSelect.CommandType=CommandType.Text;
cmdSelect.Parameters.Add("_CustomerNumber", vfx.TNM);
dr = cmdSelect.ExecuteReader();
Throws SQLSRV32.DLL - ERROR [42S22] [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name '_CustomerNumber'
No kidding _CustomerNumber is an Invalid Column name. I’m trying to replace it with vfx.TNM. If I look at the Command object in the watch window Parameters.items[0].parametername = “_CustomerNumber” and Parameters.items[0].Value = “000122”
So why isn’t it getting to the db that way.
I’ve also tried
txtSelect.Text = “Select System_id From [DFIParmsHTS].[docsadm].[ExtGroup] where CustNumber = @CustomerNumber”
OdbcCommand cmdSelect= new OdbcCommand(txtSelect.Text, conn);
cmdSelect.CommandType=CommandType.Text;
cmdSelect.Parameters.Add("@CustomerNumber", vfx.TNM);
dr = cmdSelect.ExecuteReader();
Throws SQLSRV32.DLL - ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Must declare the variable '@CustomerNumber'
So to me it looks like the Command isn’t committing the changes of the parameters to the query. That made me try:
txtSelect.Text = “Select System_id From [DFIParmsHTS].[docsadm].[ExtGroup] where CustNumber = @CustomerNumber”
OdbcCommand cmdSelect= new OdbcCommand(txtSelect.Text, conn);
cmdSelect.CommandType=CommandType.Text;
cmdSelect.Parameters.Add("@CustomerNumber", vfx.TNM);
cmdSelect.Prepare();
dr = cmdSelect.ExecuteReader();
And that didn’t work either.
Any help is appreciated, Thanks.
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|