|
I am quite new to c# ..I want to create a contact form...
I created the front end design
which contains...
one text field to write comment and two buttons
SUBMIT and RESET.....
How to write code for SUBMIT and RESET buttons such that on clicking SUBMIT button the comment must be sent to an e-mail id and on clicking
RESET button the text field must be set empty..
|
|
|
|
|
In order to send e-mail you can use system.net.mail class. For resetting fields just set text to ""
|
|
|
|
|
it is very better if you use ASP.NET Server controls like Button, its very better than asp controls
Human knowledge belongs to the world
|
|
|
|
|
This question has probably been asked a million times here but I'll be danged if I can't find any answers to this.
I am trying to write a couple of methods that I can pass any custom class or collection into and using reflection it will pull out the properties of the class and format things out into a report. I've got the method for handling an individual class. What I'm having trouble with is the collection. Does anybody know of how to take a custom collection and use reflection to pull out each individual item from the collection? Once I have the item, I will pass it into my other method for pulling out the properties. Most of the collections I will be dealing with are derived from List<t>. Could the collection method accept an object array (Object[]) without any conversion issues or should it accept the collection as a single Object?
My mind is like an aluminum trap. Some things get caught in the trap, and some things bend the trap and get away.
|
|
|
|
|
Sounds to me like you would want to have the method take IEnumerable<T>
|
|
|
|
|
I have this error , but my file is not a read-only, it is writtable ? How to solve it?
Thanks
|
|
|
|
|
Some other process will be using this file. Try to end the process which is using this file.
|
|
|
|
|
The error means some other process is using the file. It does not matter if it is not read-only.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
what is New Text Document.xsl ? I found out that i could not see my xml file if i don't put that xsl file in the same folder with my xml file ?Why?
Thanks
|
|
|
|
|
actually .xsl is schema file file for .xml files.Generally, the problem doesn't occur.Elaborate it little more.
Cheers!!
Brij
|
|
|
|
|
If i remove xls file form the same folder with xml file. When i open my xml file, this will appear:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
The system cannot locate the resource specified.
|
|
|
|
|
Do you mean that you could not see the xml file in the file listing, or are you using some program to display the content of the xml file that requires the xsl file?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
i don't know. That's why i ask why we need xsl file in the same folder with xml file in order to view the xml file?
|
|
|
|
|
hung1984 wrote: i don't know.
You don't know what you mean?
hung1984 wrote: That's why i ask why we need xsl file in the same folder with xml file in order to view the xml file?
Well, that answers part of my question, as the problem obviously is with viewing the content of the file. What program are you using to view the content of file?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
i have a problem with my c# project..
im using a listview grid in generating my database. and my problem is that it won't increment the number.. can anyone help me?? plss
|
|
|
|
|
There are a number of things wrong with this post
Your title should be relevant to the content of your problem
A listview cannot "generate" your database
Do you mean a listview or a datagridview there is no such control as a listview grid. The behaviour of these 2 controls is radically different.
Your question does not make any sense, probably because your understanding of your problem is too limited to allow you to state it in terms we can understand.
Define the control
define the method of populating the control from the database
define the problem you are facing in more detail
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
come again???
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hi there
I have a .txt file with the following dates (string \t\t int):
aaaaa 5
aaaaa 6
aaabb 7
aaaaa 1
aaabb 5
...
My question is about what data structure to use in order to access as fast is possible those data(read only).
I'm very new to C# but I have some experience in C++. There a struct array was an alternative but I don't know how to do that in C#.
I have to search a string and order the result desc after the int number.
Example:
search 'aaabb'
result: 7, 5
|
|
|
|
|
regexp \b[a-z]+\b\t\t([0-9]+) with option multiline and ignorecase
Code? Yeah i love it fried together with a glass of wine.
|
|
|
|
|
You can use something like this:
string line = "";
List<int> values = new List<int>();
using(FileStream stream = File.OpenRead("textfile.txt"))
using(StreamReader reader = new StreamReader(stream))
{
while ((line = reader.ReadLine()) != null)
{
Match match = Regex.Match(line, @"^aaabb\s+(\d+)$");
if (match.Success)
values.Add(Int32.Parse(match.Groups[1].Value));
}
}
</int></int>
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Probably the quick/simple in-memory data structure would be a Dictionary< string, List< int>>. Dictionarys are a hashtable, so lookups are log-n. I'm assuming from your example that there is a small number of ints.
As for parsing the file, I'd ignore the other suggestions to use regexs if the file is large. Its said that when a man is faced with a problem and decides to solve it with a regex, then he now has two problems Just string.Split on the space - it'll be orders of magnitude faster than the regex.
|
|
|
|
|
Right answer, but hash-table lookups are O(1).
|
|
|
|
|
Ooops. Good spot
Both insertion and retrieval should be close to O(1). However the default size of the Dictionary class is 3 - and increasing the capacity is O(n), which is done by increasing the capacity to the next prime number (not sure on the reasoning behind that). This shouldn't affect the use of the Dictionary for this task - we always pick suitable initialization sizes for our collections right guys?
|
|
|
|
|
duta wrote: I'm very new to C# but I have some experience in C++. There a struct array was an alternative but I don't know how to do that in C#.
A struct in C++ is a different thing from a struct in C#. In C++ a struct is a definition for either an object or a value type, but in C# a struct is always a value type.
To efficiently search the data, you should use a data structure like Dictionary<string, List<int>> .
Something like:
Dictionary<string, List<int>> items = new Dictionary<string, List<int>>();
foreach (string line in File.ReadAllLines(pathName)) {
string[] data = line.Split('\t');
List<int> list;
if (!items.TryGetValue(data[0], out list) {
list = new List<int>();
items.Add(data[0], list);
}
list.Add(int.Parse(data[2]));
}
List<int> aaabb = items["aaabb"];
aaabb.Sort();
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Personally I would read the data into a datatable using CSVtoTable[^] and then use either linq or a dataview to manupulate the data.
This is not the "fastest" method as the datatable carries a fair overhead.
Never underestimate the power of human stupidity
RAH
|
|
|
|