|
Please don't repost questions so soon after you posted the original.
|
|
|
|
|
Hi, I want to Generate Rayleigh,Erlang,Exponential,Impulse,Uniform Noise in c#. Have everybody sample code?please Help me
|
|
|
|
|
Please use Google to search for samples.
|
|
|
|
|
i developed windows app. the user i insert his name in textbox as
"محمد عبدالرحيم" and when i printed through printeddocument it appear in paper as this 'د م ح م د 'as a separated word can any one answer me
|
|
|
|
|
I'm so lost..I don't even know where to begin.
This is what I need to do...
use Streamreader to get a file (USPopulation.txt)
use Methods
use listbox or listview
- 3 columns ( Year, Population, % Increase )
- Years are 1950-1990
- Populations numbers need to be formatted from file ( 100000 to 100,000 )
- % Increase is increase between current year and previous year
use textboxes to show years of:
- average increase
- greatest change
-least change
I have form built, exit and clear buttons done.
I have some code for the calculate button, but either one thing works or the other does...
namespace PopData
{
public partial class FormPopData : Form
{
const int SIZE = 39;
const int NEW_SIZE = 39;
int[] population = new int[SIZE];
int[] pop_diff = new int[NEW_SIZE];
int index;
public FormPopData()
{
InitializeComponent();
}
private void buttonCalculate_Click(object sender, EventArgs e)
{
StreamReader inputFile = File.OpenText("USPopulation.txt");
List<int> PopulationList = new List<int>();
int year = 1950;
while (!inputFile.EndOfStream)
{
PopulationList.Add(int.Parse(inputFile.ReadLine()));
}
inputFile.Close();
int numberofyears = PopulationList.Count();
int average = Average(PopulationList);
textBoxAverage.Text = average.ToString();
int greatest = year + GreatestIncrease(PopulationList);
textBoxGreatest.Text = greatest.ToString();
int least = year + LeastIncrease(PopulationList);
textBoxLeast.Text = least.ToString();
}
}
private int diff(int[] population)
{
int count = 0;
try
{
pop_diff = new int[NEW_SIZE];
for (int index = 1; index <= population.Length - 1; index++)
{
pop_diff[count] = population[index] - population[index - 1] / populationindex - >1];
count += 1;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return pop_diff[count];
}
private int Average(List<int> PopulationList)
{
int amountofchange = 0;
int changeinyears = 0;
int thechange = 0;
int currentyear = 0;
for (int index = 0; index < PopulationList.Count; index++)
{
thechange += PopulationList[index];
currentyear = index;
}
amountofchange = (int)thechange / PopulationList.Count;
return changeinyears;
}
private int GreatestIncrease(List<int> PopulationList)
{
int amountofchange = 0;
int changeinyears = 0;
int thechange = 0;
int currentyear = 0;
for (int index = 1; index < PopulationList.Count(); index++)
{
thechange = PopulationList[index] - PopulationList[index - 1];
currentyear = index;
if (thechange > amountofchange)
{
amountofchange = thechange;
changeinyears = index;
}
}
return changeinyears;
}
private int LeastIncrease(List<int> PopulationList)
{
int firstitem = PopulationList.First();
int lastitem = PopulationList.Last();
int amountofchange = (lastitem - firstitem);
int changeinyears = 0;
int thechange = 0;
int currentyear = 0;
for (int index = 1; index < PopulationList.Count(); index++)
{
thechange = PopulationList[index] - PopulationList[index - 1];
currentyear = index;
if (thechange < amountofchange)
{
amountofchange = thechange;
changeinyears = index;
}
}
return changeinyears;
}
|
|
|
|
|
A couple of suggestions:
- Create a class for your population entries, and a list of its objects.
- Add another method to read the file and create the list of population objects
- Use that list as binding source for your listview. See A Detailed Data Binding Tutorial[^] for information on how to do it.
|
|
|
|
|
I was looking through my C# book and came across this example project. It asked you to create a one-form application that will gather the following:
First Name
Last Name
Address
City
State
Zip
Telephone
You must include the following features:
The form must start in the center of the screen.
You must have a nice title for your form.
There must be an END button that stops your program.
You need another button that will display a message box when they click it. The message needs to say "Thanks for shopping [Name]".
All the fonts/colors/alignments must look clean and orderly.
I know to an experienced C# programmer, this kind of stuff is second nature. I'm looking for anyone who could help create this for me so I can look at it and use it as a resource for my class(since the book didn't show how to do it!) Thanks!
|
|
|
|
|
Nobody is going to create this project for you.
The book DOES show you how to it, just in very small parts. It's up to you to figure out how those little pieces fit together to make the application as described.
|
|
|
|
|
Im sorry. I meant can anybody point me in the right direction as where to start, etc. I've read the book up to this point and I am still confused. I hope that's clear enough
|
|
|
|
|
Member 10784174 wrote: I am still confused
How are we to know what it is that confuses you unless you tell us? First thing is start be researching how to set the start up position of a form. Then do the next thing, then the next.
|
|
|
|
|
i dont know i thought all you people were smart
|
|
|
|
|
Member 10784174 wrote: you people were smart
Smart does not give us the ability to read your mind. If you cannot do your own homework assignment what makes you think that someone else should do it for you? Read your textbook and pay more attention class.
|
|
|
|
|
We are (mostly), but we're not psychic!
We don't know what you don't understand.
The book should have shown you how to create a new Windows Forms project in Visual Studio.
Then you will add labels and text boxes to the form, adjust their style (font, size, etc.)
Then add the buttons and the handlers (code) to execute when the button is pressed.
Part of the learning will be how to use the documentation.
What things are called and what to search for when you are stuck.
When you've put some effort into doing it yourself, then come back and ask specific questions about issues with which you are having difficulty.
You'll make more progress in the long run if you tough it out in the early stages and build confidence that you can do it.
Later on you'll realize that you just need a little specific information/assistance as you tackle more advanced topics.
(Instead of just throwing up your hands "I don't know where to start"!)
|
|
|
|
|
Yes, we are. We're also smart enough to NOT write a students application for them!
What you're asking for is very simple stuff. This is stuff you should be able to do without even thinking about it. If you're asking other people how to do this, you've got more reading to do.
Try building a sample app that just shows its window in the center of the screen. You've already been shown how to do this in the book, so go find it. I'll give you a hint though, it's one little property change.
A very large part of writing code is acquiring the ability to teach yourself. Without that skill, you're skill set is going to be outdated very quickly.
|
|
|
|
|
Create Model class with following details.
First Name
Last Name
Address
City
State
Zip
Telephone
Follow code first or any other approach.
Using Entity Frame or simple db connection you can communicate with db to run insert/update/delete.
|
|
|
|
|
I suggest you use bootstrap css to design your form. They have pretty good form designs.
|
|
|
|
|
my requirement was to capture skype voice conversation and save that conversation in file. so later we can play back. i was searching google for any article or write up to do this job.
i got a good article whose link is http://galratner.com/blogs/net/archive/2011/08/27/how-to-record-skype-voice-conversations.aspx[^]
the above article discuss how to do it and i also download their wpf based apps and run my pc. i saw that apps is working fine. also saw that apps could capture skype conversation and save to file.
i develop a small win apps following that wpf apps but my apps is working but not being able to capture the skype conversation. i copied all the necessary function in my apps from that wpf apps. just do not understand why my apps is not working or what i am missing in my code.
here i am attaching my apps download link from where anyone can download and see the code. if possible anyone download my apps and tell me what i am missing after comparing the code with wpf based apps which u can download my from first link.
here my apps link https://onedrive.live.com/#cid=C4A6F16F34D7540A&id=C4A6F16F34D7540A!126[^]
from the above link download SkypeCallTest.zip file. it would be really good help if some one looking into my apps code after download it from onedrive. thanks
tbhattacharjee
|
|
|
|
|
Only a fool would download an untrusted file and run it. No one here is likely to do this.
You have the source to both - it should be simple for you to compare them.
|
|
|
|
|
people post source code in codeproject site and million people download those....so do u think those million people are foo?
u guys do not want to help then just lay off from the post.....why putting the comments.
tbhattacharjee
|
|
|
|
|
If you're talking about the articles, the code that people download is downloaded from this site and is available for inspection in the actual CP browser window. Anyone who downloads an untrusted ZIP file, then yes - I do consider them fools.
|
|
|
|
|
cleaver people should take rest
tbhattacharjee
|
|
|
|
|
Can anybody please tell me how does a Nullable<T> work in following scenario, where I have:
int? tmp = 10;
tmp = null;
Console.WriteLine(tmp.ToString());
Console.WriteLine(tmp.GetType());
The NRE for GetType() call seems fine but I just don't get how ToString() (and ofcourse GetHashCode() and Equals(T) ) works. I know these methods have been overridden in Nullable<T> struct from System.Object where as GetType() couldn't (becuase that is not virtual ). But since ToString() is an instance method and I am explicitely setting temp = null , how does the call get resolved?
Even if I assume temp = null sets the T @value field in Nullable<T> struct and not the instance itself, it doesn't seem possible since @value would be of type System.Int32 which can't be set to null in the first place, hence we have Nullable<int> ?
I suspect this has something to do with "Type handle" reference that resides as a part of an instance but not sure how it works given that instance itself is null .
Any explanation would be greatly appreciated.
Whether I think I can, or think I can't, I am always bloody right!
|
|
|
|
|
This gets complex...
ToString is overridden, as you say - it has to be, because a nullable type "encapsulates" the ValueType it holds, and if it wasn't then it would never work!
So when you call ToString on the tmp variable, it checks the type of variable - Nullable<int> - and calls the Nullable<T> version of ToString, without worrying about the content:
IL_002a: ldloca.s tmp
IL_002c: constrained. valuetype [mscorlib]System.Nullable`1<int32>
IL_0032: callvirt instance string [mscorlib]System.Object::ToString()
IL_0037: call void [mscorlib]System.Console::WriteLine(string)
But...GetType isn't overridden - which means that the default object version must be called, which takes a Reference parameter, not a Value type. Which means that the Nullable<T> value type needs to be boxed to convert it, and it's the boxing operation that throws the NullReferenceException, not the GetType call:
IL_003d: ldloc.0
IL_003e: box valuetype [mscorlib]System.Nullable`1<int32>
IL_0043: callvirt instance class [mscorlib]System.Type [mscorlib]System.Object::GetType()
IL_0048: call void [mscorlib]System.Console::WriteLine(object)
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Your right, that is complex!
Regards,
Rob Philpott.
|
|
|
|
|
As you fully understand when creating int? you actually creates a Nullable<int>, which is a structure that actually never null. In fact it has a value member that actually holds the value - that can be null.
Now, when you call ToString you call an overridden version, that has this code:
public override string ToString()
{
if (!this.HasValue)
{
return "";
}
return this.value.ToString();
}
That explains why it works even you had expected a null reference exception...
With GetType is a different story, it is derived from object and never overridden by Nullable<t>, so it will be executed on the internal value which is null, therefor it fails!
(GetHashCode and Equals are also overridden)
You may use some decompiler to see the whole class...)
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|