|
A DataTable is just a collection of data. It doesn't have "cells", and it wouldn't make any sense to "merge" values within it.
I suspect you want to merge the cells in whatever control you're using to display the data from the DataTable . You need to tell us how you're displaying the data.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Your question is not clear. What "table" are you referring to?
Remember, we can't see your screen, access your computer, or read your mind.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi, I have an Employee class with Name, Department, and Salary as properties. All I'm trying to do is add an employee to a list of Employees after typing in all the required info and hitting the Add button on my form.
Then I want to display the employees in the list of Employees using a foreach loop. Below are my code but they're not working and I get no errors.
namespace CSharpListObjects
{
public partial class Form1: System.Web.UI.Page
{
List<Employee> employees = new List<Employee>();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnShowEmployees_Click(object sender, EventArgs e)
{
StringBuilder employeeDetails = new StringBuilder();
foreach(Employee e in employees)
{
employeeDetails.Append("< br/>Name: " + e.Name
+ " Department: " + e.Department
+ " Salary: " + e.Salary + "< br/ >");
}
Literal1.Text = employeeDetails.ToString();
}
protected void btnAddEmployee_Click(object sender, EventArgs e)
{
Employee employee = new Employee();
employee.Name = txtName.Text;
employee.Department = txtDepartment.Text;
employee.Salary = Convert.ToInt32(txtSalary.Text);
employees.Add(employee);
}
}
}
It appears there is nothing in List < Employee > after I added Employee objects. Please help point out where my mistake is if you can spot it, thanks.
modified 4-Jan-16 2:05am.
|
|
|
|
|
I see that this is a question about an ASP.NET project. We do have a dedicated forum for that, that you should consider posting questions like this on, in the future.
Anyway, the problem is because your list of employees is lost between one postback and the next. You have to consider the nature of a web site, which is short lived in the duration of what happens in the code because each post back from the client to the server effectively fires off a new instance of this page. What you need to do is either store your list in a cache or a session object and then retrieve it from there. The choice of whether to host it in the Cache or in a Session depends on whether you want this list to be visible to everyone (stored in the Cache), or just for the user who is entering the current details (store it in the Session).
This space for rent
|
|
|
|
|
Thanks for replying. Your suggestion did the trick.
|
|
|
|
|
Hi Team,
I have a C# app where the only localization that needs to be done is in the Menu Strings. So instead of the strings being stored in a resx file (OR BAML), I was thinking of storing that in a keyvalue pair .properties file that can be dynamically updated from a CDN. This way if a new locale has to be supported, all we need to do is add the corresponding property file for that locale.
Anyone tried this approach and any recommendations/things I have to take care of?
Thanks,
Chandra
|
|
|
|
|
Good morning, i would like to develop a fingerprint students attendance, But the problem i face is not sure how and where to start. The help provided really will be helpful to me. I will develop using c# provided by digital persona sdk. i have basic knowledge in c# but able to lern.
|
|
|
|
|
The first thing you need is a fingerprint reader. A study of its documentation will get you started.
|
|
|
|
|
Just be sure you get the most recent SDK. At least in prior versions of the Digital Persona SDK, there's at least one really serious memory leak when using a Streamed image from the 4500 / 5100 series readers.
Also, under existing privacy laws, fingerprints fall under protections for PII -- personally identifying information. So students or not, you have to be really careful about what you do with the fingerprint records.
The madman is not the man who has lost his reason; the madman is the man who has lost everything except his reason.
--G.K. Chesterton
|
|
|
|
|
You have replied to the wrong person. Richard doesn't need to know this.
This space for rent
|
|
|
|
|
Nareen Nair wrote: Sir i have bought the device digital persona fingerprint reader. The adk provided only show sample of indentification and enrollemnt. They did not provide me how to save to database. So i am confuse on it sir The device i bought is U.are.U 5100 Saving information to a database is nothing to do with a fingerprint reader. Once you have the input data from the reader you just send it to your database in the same way you would any other input data.
|
|
|
|
|
owh... thanks Richard.. now i got soem idea... i researching more in how to save to database directly. You are helpful sir... i try research and find out how to do that.. or is there any link i can go through sir, sir can share..
|
|
|
|
|
Nareen Nair wrote: is there any link i can go through Yes, www.google.com[^]. But you need to explain your problem more clearly. We have no idea which database you are using or what problems you are having with it. If you are still learning about databases then Google will find you many samples and tutorials.
|
|
|
|
|
i am using oracle as my databse. The problem is i not sure how would it save the fingerprint to the database..
|
|
|
|
|
It depends on what you retrieve from the fingerprint reader. The data that it provides is presumably a digitised representation of an image, so that is what you need to save. Whether you save it in the database, as a blob, or as a normal file with a link in the database is up to you. But the first thing to do is undertstand the format of the data that the reader provides.
|
|
|
|
|
owh.. now i have some idea.. i try and see on the format that the reader will save... if i have other question i would ask.. and thanks alot as without ur help i will be blur on where to start thanks..
|
|
|
|
|
Hi all,
I have a mdi application which have Form1 and Form2 each form has a public Function named MyPrint(). So I want to create a button on the MDI parent form which will call the MyPrint() function of the ActiveMdiChild form i.e:
Form curForm=new Form();
curForm.Print();
how to make it possible to call MyPrint() of each form implicitly.
thanks in advance
APC Corner
|
|
|
|
|
The way I would do it is to create a form derived from Form which includes an overridable MyPrint method, and derive my MDI children from that. That way, the main form can call the correct version without explicitly knowing which it needs to look for.
But your code fragment won't do it: that creates a new form rather than trying to access a method in an existing displayed form. Try looking at the Form.ActiveMdiChild Property (System.Windows.Forms)[^] instead.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
It's a mistake to place any Control on the MDIParent Form surface: it will then appear above all MDI Windows that may be "under" it, and make a visual mess. If you must have a Button, place it in a MenuStrip on the MDIParent Form.
One way to get the "implicit" functionality you describe is to define an Extension Method on the Form Class for printing:
using System;
using System.Windows.Forms;
namespace YourMDINameSpace
{
public static class FormExtensions
{
public static void Form_Print(this Form form)
{
Console.WriteLine("{0} is printing now", form.Name);
}
}
} If you drag-drop a MenuStrip onto the MDIParent Form, you can then choose the option for it to insert the standard items which will include a 'File Menu with a 'Print sub-menu item. By defining an EventHandler for that 'Print menu-item, you can write your code that handles printing:
private void printToolStripMenuItem_Click(object sender, EventArgs e)
{
if(ActiveMdiChild != null) ActiveMdiChild.Form_Print();
} The code shown here assumes you have implemented the Extension shown above; note that you use the 'ActiveMDIChild directly to invoke the method.
«Tell me and I forget. Teach me and I remember. Involve me and I learn.» Benjamin Franklin
modified 2-Jan-16 7:24am.
|
|
|
|
|
Downvote countered. Have yourself a 5 and a Happy New Year from me.
This space for rent
|
|
|
|
|
An alternative approach is to use an interface to describe the method you want to use and then let each form implement it, only if it needs to print. So, you would have something that looks like this:
public interface IPrint
{
void Print();
} Then, when you need to print, you would have something that looks a bit like this in the code that calls Print.
if (ActiveMdiChild != null)
{
IPrint printForm = ActiveMdiChild as IPrint;
if (printForm != null)
{
printForm.Print();
}
}
This space for rent
|
|
|
|
|
You could simplify that by removing the outer if block - if ActiveMdiChild is null , then ActiveMdiChild as IPrint will also be null .
IPrint printForm = ActiveMdiChild as IPrint;
if (printForm != null)
{
printForm.Print();
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Indeed you can.
This space for rent
|
|
|
|
|
I want to use a DataBase Connection which is open to an IValueConverter. The Language is C# and the Framework 4.5. The Database Connection is created whith Npgsql to an Postgres Database.
namespace WpfApplication
{
public class GetToltipStatus : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
!!HERE I NEED THE CONNECTION CONN!!
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
public partial class Tab_100 : System.Windows.Controls.UserControl
{
public NpgsqlConnection conn;
public Tab_100(NpgsqlConnection conn100)
{
conn = conn100;
}
}
The Mehtode Tab_100 is started and get an opened Database Connection (conn100). For the IValueConverter I need this. I could not use an public static Connection and because of that I colud not access like Tab_100.conn. Is there an other way to get the Connection from the class Tab_100 in the IValueConverter ?
|
|
|
|
|
You shouldn't be attempting to access the database directly from a value converter. If you are using MVVM,you should be interacting with a Model from your ViewModel.
This space for rent
|
|
|
|