|
Did you figure this out, I need to do the same. I was just reading about binding sources and changing the data source property and it will automtically change the data in the grid.
Michael
|
|
|
|
|
how to pass the value for the parameter for the crystal report from the main form
|
|
|
|
|
client request :
they need save the report everday, so we must generate static report ,
How can i do that?
can you give me a demo code, not microsoft one , because I tried it failed
thank you!
|
|
|
|
|
hi all.
is there a way to do a message count down counter?
so that whenever a user types the maximum of 160 characters, the program will detect it and a message box will appear.
thanks.
|
|
|
|
|
If you are using a textbox say txtName then you can write an event handler for KeyPressed event. Like....
<br />
private void txtUname_KeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
if (txtUname.Text.Length == 160)<br />
{<br />
MessageBox.Show("Text5");<br />
}<br />
}<br />
Hopefully it will solve your problem.
Mujtaba
"If both of us are having one apple each and we exchange it, at the end we both will have one apple each. BUT if both of us are having one idea each and we exchange it, at the end both of us will be having two ideas each."
|
|
|
|
|
thanks.
|
|
|
|
|
I am trying to load up a dataset from an SQL table, after the first row the code is exited at the following line:
dr = dt.NewRow();
There are 10,000 lines in the SQL table do you have any ideas on why this is happening.
DataSet_I.BSDDataTable BSD = new DataSet_I.BSDDataTable();
if (strTableName == "xxxxx")
{
dt = BSD;
if (Rowset != null && Rowset.IsOpen)
{
int nCol = 0;
//int nCols = Rowset.Cols;
Rowset.MoveFirst();
while (!Rowset.IsEOF)
{
dr = dt.NewRow(); **************EXITS CODE on 2nd PASS******************
foreach (DataColumn dc in dt.Columns)
{
nCol++;
object dcValue = Rowset.GetData(nCol);
if (dcValue != null)
{
if (dc.DataType == typeof(System.String))
dr[dc] = (string)Rowset.GetData(nCol);
else if (dc.DataType == typeof(System.Int32))
dr[dc] = (int)Rowset.GetData(nCol);
else if (dc.DataType == typeof(System.Single))
dr[dc] = (float)Rowset.GetData(nCol);
else if (dc.DataType == typeof(System.DateTime))
dr[dc] = (DateTime)Rowset.GetData(nCol);
}
}
dt.Rows.Add(dr);
Rowset.MoveNext();
}
}
Also, can I assign a set number of rows to the DataTable before I start and just load without adding new rows.
Any help would be greatly appreciated.
Thanks in advance.
Michael
|
|
|
|
|
Is there any exception? If yes then what is the exception message?
Mujtaba
"If both of us are having one apple each and we exchange it, at the end we both will have one apple each. BUT if both of us are having one idea each and we exchange it, at the end both of us will be having two ideas each."
|
|
|
|
|
There is no exception message is just continues on to the next table (I am trying to load multiple tables).
Michael
|
|
|
|
|
Hi there,
I am using this stored procedure in sql.
I have 6 tables. One is called employees. This is what I need to be able to do. A user enters a new employee into a winform, picks a role, division, manager, technicalskill set and applications from the drop down lists and hits save. The employee table should be the only one updated and has these columns only.( firstname, lastname, dvisionid, managerid, roleid,techskillsid, and appID). At the moment what is happening is its saving the firstname, lastname correctly, but the rest of the ID columns are null. It is updating the other tables with the string entered but what I need is the emplyee table to update with the corresponding ids. Is this alot more complicated then i thought? If I try to replace the role with roleid etc, it will just tell me I can't convert string to int which is understandable. How do I do this?
CREATE PROCEDURE sp_InsertEmployee
@Firstname nvarchar(50),
@Lastname nvarchar(50),
@Role nvarchar(50),
@Manager nvarchar(50),
@Division nvarchar(50)
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO EMPLOYEES (FIRSTNAME, LASTNAME) VALUES (@FIRSTNAME, @LASTNAME)
INSERT INTO [ROLE] ([ROLE]) VALUES (@ROLE)
INSERT INTO MANAGER (MANAGER) VALUES (@MANAGER)
INSERT INTO DIVISION (DIVISION) VALUES (@DIVISION)
END
GO
My C# code is like this:
SqlCommand sqlC = new SqlCommand("sp_InsertEmployee", myConnection);
sqlC.CommandType = CommandType.StoredProcedure;
sqlC.Parameters.Add(new SqlParameter("@Firstname", SqlDbType.VarChar, 50, "Firstname"));
sqlC.Parameters.Add(new SqlParameter("@Lastname", SqlDbType.VarChar, 50, "Lastname"));
sqlC.Parameters.Add(new SqlParameter("@RoleID", SqlDbType.Int, 50, "RoleID"));
sqlC.Parameters.Add(new SqlParameter("@ManagerID", SqlDbType.Int, 50, "ManagerID"));
sqlC.Parameters.Add(new SqlParameter("@DivisionID", SqlDbType.Int, 50, "DivisionID"));
//sqlC.Parameters[0].Value = 4;
sqlC.Parameters[0].Value = FirstnameText.Text;
sqlC.Parameters[1].Value = Lastnametext.Text;
sqlC.Parameters[2].Value = RolecomboBoxTest.Text;
sqlC.Parameters[3].Value = ManagercomboBox1.Text;
sqlC.Parameters[4].Value = DivisioncomboBox2.Text;
int i = sqlC.ExecuteNonQuery();
//sqlC.ExecuteNonQuery();
Sorry for pasting so much.
|
|
|
|
|
Actually, this is an easy question, about converting formats. int.TryParse is how you get an int out of a string.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
falles01 wrote: At the moment what is happening is its saving the firstname, lastname correctly, but the rest of the ID columns are null.
Of course they are. You don't specify any values for them.
falles01 wrote: It is updating the other tables with the string entered but what I need is the emplyee table to update with the corresponding ids. Is this alot more complicated then i thought?
As you obviously thought that it would happen automatically, yes, it's a lot more complicated than that.
You have to add the other values first, and get the id that is created for each record:
declare @RoleId int<br />
insert into [ROLE] ([ROLE]) values (@ROLE)<br />
set @RoleId = scope_identity()
Then you can use these values when you insert into EMPLOYEES.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thank you, but I decided to just use my insert statement for now as that works.
My question now is how exactly do I get selected values of a checkedlist box and store it as ID numbers in the database. I had something like this which is obviously wrong. It works for the comboboxes but then I heard you need for loops to check multiple selections in a checkedlistbox. Feel free to just change my code.
if (this.techSkillsCheckListBox2.CheckedItems.Count > 0)
{
label1.Text = "worked";
foreach (string item in this.techSkillsCheckListBox2.CheckedItems)
{
string sql = "INSERT INTO employees(Firstname,Lastname,RoleID,DivisionID,ManagerID,TechnicalSkillsID) Values ('" + FirstnameText.Text.ToString() + "' , '" + Lastnametext.Text.ToString() + "' , " + RolecomboBoxTest.SelectedValue.ToString() + "," + DivisioncomboBox2.SelectedValue.ToString() + " , " + ManagercomboBox1.SelectedValue.ToString() + " , " + techSkillsCheckListBox2.SelectedValue.ToString() + ")";
Don't worry this won't be used commercially so I was told not to worry about injection attacks until I can get these correct.
Thank you for helping out.
|
|
|
|
|
falles01 wrote: It works for the comboboxes but then I heard you need for loops to check multiple selections in a checkedlistbox.
If you have a control that allows mutiple selections, then you have to use the SelectedItems property instead.
You also have to change your database design so that it allows for multiple values.
---
single minded; short sighted; long gone;
|
|
|
|
|
It doesn't allow multiple selections though. Okay well apart from the database side of things I believe I have to use a 'for' loop.
why does the following return an error?: The name 'Checked' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
foreach (int indexChecked in techSkillsCheckListBox2.CheckedIndices)
{
string sql = "INSERT INTO employees(Firstname,Lastname,RoleID,DivisionID,ManagerID,TechnicalSkillsID) Values ('" + FirstnameText.Text.ToString() + "' , '" + Lastnametext.Text.ToString() + "' , " + RolecomboBoxTest.SelectedValue.ToString() + "," + DivisioncomboBox2.SelectedValue.ToString() + " , " + ManagercomboBox1.SelectedValue.ToString() + " , " + techSkillsCheckListBox2.GetItemCheckState(indexChecked).ToString() + ")";
SqlCommand sqlC = new SqlCommand(sql, myConnection);
}
}
Anyone. I have been baffled by this for 8 hours. Its especially annoying when it was so easy to work out the combobox selections.
Thanks again.
|
|
|
|
|
Hey all,
I was looking for a way to iterate through all properties for a given control, but am only finding ways to access individual properties.
I am generating lists of all controls on a target form, but would also like to list all properties for each.
Regards.
-- modified at 18:48 Sunday 2nd September, 2007
|
|
|
|
|
ushering wrote: I am generating lists of all controls on a target form, but would also like to list all properties for each.
Use reflection. See the documentation for the System.Reflection namespace
Off the top of my head something like this will get you all the properties on a class (not just controls, any class)
Type controlType = myControl.GetType();
PropertyInfo[] properties = controlType.GetProperties();
DISCLAIMER: This is as I remember it, I haven't checked that the real methods are exactly as stated.
|
|
|
|
|
Hello
How i can know when the user press the back space button
i work in the key_press event but how to specify the back space:
if e.keychar = ...
Thanks a lot
Assaf
|
|
|
|
|
Try something like:
Convert.ToInt16(e.KeyChar) == 8
Replace 8, which is ASCII for backspace, with other values you may want to trap.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
The event has an event args, which incudes an instance of the Keys enum. There is a Keys.Backspace.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have 4 textbox where in each one i write 4 char and the 5th will be written in the next one
i want also when deleting from any one of these textbox when i delete 4 chaacere automatically i go to one before and begin to delete the last charactere in it.
how i can do that ???
Thanks in advance
Assaf
|
|
|
|
|
Assaf82 wrote: I have 4 textbox where in each one i write 4 char and the 5th will be written in the next one
So, handle the key up event, check if your control has four characters, and if so, move focus to the next one
Assaf82 wrote: i want also when deleting from any one of these textbox when i delete 4 chaacere automatically i go to one before and begin to delete the last charactere in it.
Same sort of thing
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello all,
I was trying to use Tao framework 2.0 for C#.net and OpenGL. However, the tessellator in that version seems to be broken. Does anyone know of a way to tessellate a concave polygon (described by boundary only verticies) into a convex polygon (either save the verticies of the tessellated object with edge flags or into a format readable by OpenGL)?
Thanks,
Mike
P.S. If someone got The Tao Framework's tessellator to work, please let me know which version.
Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
|
|
|
|
|
Take your vertexes that describe the boundary and order them. Then find the centroid point. Then make a triangle fan around that centroid.
Hope that helps.
|
|
|
|
|
I do not believe that will work. For instance:
Think of the letter: "U". The centroid is located in the bottom part of the U, but you cannot create a triangle fan around this point without making the U into a UV hybrid (pretty much a U with a V inside).
If I misunderstand, please correct me.
Thanks,
Mike
FREE 28 player online game @ http://www.1483online.com where the community drives enhancements to the game!
|
|
|
|
|