|
thanks man it worked
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I'm running a process in a thread and want to put the results as they happen in a text box on my form. Is that possible? I cant seem to make it work.
|
|
|
|
|
It's possible, you just have to transfer the results to the UI thread before updating the text box. 2 common ways of doing this:
textBox.Invoke((MethodInvoker)delegate()
{
textBox.Text = "here are the results...";
}); The other common way and recommended way is to use a BackgroundWorker[^] component. It lets you run work on a background thread and call worker.ReportProgress, which fires an event on the proper thread, allowing you to update your UI in there.
Life, family, faith: Give me a visit.
From my latest post: "When Constantine severed the Hebrew origins of this faith in Messiah, a new religion was officially created. It is this religion that Orthodox Jews fear their relatives and friends becoming members of."
Judah Himango
|
|
|
|
|
I don't believe the cast to MethodInvoker is necessary.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
It is because the parameter type is Delegate. The compiler cannot infer which delegate type you mean when passing in an anonymous method; you'll get a "cannot convert anonymous method to type System.Delegate because it is not a delegate type" compiler error.
Life, family, faith: Give me a visit.
From my latest post: "When Constantine severed the Hebrew origins of this faith in Messiah, a new religion was officially created. It is this religion that Orthodox Jews fear their relatives and friends becoming members of."
Judah Himango
|
|
|
|
|
I've being using objectDataSources to populate some data controls lately. My data access objects return collections of objects rather than DataTables or DataSets. The inherent problem with this is you can't sort a collection by any column (e.g. if I had an EmployeeCollection filled with Employee objects I couldn't sort by Employee.LastName in one method and then Employee.Id in another). So I set out to create a sortable list I could inherit from and be able to sort my collections.
What I have is below, but the problem I have is that I'm converting my generic variables to strings so that I can compare them. I suppose this works fine as long as I override ToString() on my objects so that it makes sense, but it seems like a bit of a kludge. Does anyone have any other ideas that might work?
using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
namespace IssueTracker.Business.Collections
{
public class SortableList<T> : List<T>
{
public void SortBy(string sortExpression, SortDirection sortDirection)
{
Sort(delegate(T t1, T t2) { return Compare(t1, t2, sortExpression, sortDirection); });
}
private static int Compare(T t1, T t2, string propertyName, SortDirection sortDirection)
{
object t1Value = t1.GetType().GetProperty(propertyName).GetValue(t1, null);
object t2Value = t2.GetType().GetProperty(propertyName).GetValue(t2, null);
StringComparer comparer = StringComparer.CurrentCulture;
int result = comparer.Compare(t1Value.ToString(), t2Value.ToString());
if (sortDirection == SortDirection.Descending)
result = result*-1;
return result;
}
}
}
|
|
|
|
|
I'm not sure what you are trying to do but List<> is already sortable
public class Employee
{
public string FName;
public string LName;
public Employee(string fname, string lname) { FName = fname; LName = lname; }
public static int CompareFirstName(Employee e1, Employee e2)
{ return e1.FName.CompareTo(e2.FName); }
public static int CompareLastName(Employee e1, Employee e2)
{ return e1.LName.CompareTo(e2.LName); }
}
List<Employee> list = new List<Employee>();
list.Add(new Employee("Joe", "Smakatelly"));
list.Add(new Employee("Sue", "Rummy"));
list.Sort(Employee.CompareFirstName);
Console.WriteLine("First Name");
foreach (Employee e in list)
Console.WriteLine("{0} {1}", e.FName, e.LName);
list.Sort(Employee.CompareLastName);
foreach (Employee e in list)
Console.WriteLine("{0} {1}", e.FName, e.LName);
led mike
|
|
|
|
|
Hello my name is Henry Javier.
I need implement an application to take the total control of PC, this is similar of a cyber control application....
please helme... this is for my university...
I sorry my english is very bad....
Hola a todos mi nombre es Henry Javier y necesito crear una aplicacion en C# la cual sea capaz de tomar el control total de una PC algo similar a un cyber cafe...
me pueden ayudar....
por favor
|
|
|
|
|
hendryck wrote: I sorry my english is very bad....
No importa. Mi espan~ol está mucho mas mal.
But, you know the word "café" also exists in English which results in "cybercafé"
Coffee is the drink. A "café" is a place which sells coffee for consumption on the premisis.
|
|
|
|
|
hi there,
has anyone any idea of how i could implement the coverflow (mac) or shift window switching (vista) effect?
i've tried some ideas like quadric or exponential methods but they didn't turn out..... so here i am asking for some advice?
thanks,
andreea
|
|
|
|
|
this is my code. or part of it
{
:
:
this.sqlConnection1.ConnectionString = "workstation id=S6W6Q4;packet size=4096;integrated security=SSPI;data source=S6W6Q" +
"4;persist security info=True;initial catalog=master";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO [\'List For Haj Ballot$\'] ([List For Haj Ballot 2008], F2, F3, F4, F5," +
" F6) VALUES (@Param1, @F2, @F3, @F4, @F5, @F6); SELECT [List For Haj Ballot 2008" +
"], F2, F3, F4, F5, F6 FROM [\'List For Haj Ballot$\']";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param1", System.Data.SqlDbType.Float, 8, "List For Haj Ballot 2008"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F2", System.Data.SqlDbType.Float, 8, "F2"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F3", System.Data.SqlDbType.NVarChar, 255, "F3"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F4", System.Data.SqlDbType.NVarChar, 255, "F4"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F5", System.Data.SqlDbType.NVarChar, 255, "F5"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F6", System.Data.SqlDbType.NVarChar, 255, "F6"));
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "\'List For Haj Ballot$\'", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("List For Haj Ballot 2008", "List For Haj Ballot 2008"),
new System.Data.Common.DataColumnMapping("F2", "F2"),
new System.Data.Common.DataColumnMapping("F3", "F3"),
new System.Data.Common.DataColumnMapping("F4", "F4"),
new System.Data.Common.DataColumnMapping("F5", "F5"),
new System.Data.Common.DataColumnMapping("F6", "F6")})});
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.LimeGreen;
this.ClientSize = new System.Drawing.Size(686, 548);
this.Controls.Add(this.label8);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.label7);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.label6);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label5);
this.Controls.Add(this.button1);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.label4);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "APL Haj Ballot System";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
/*try
{
//SqlConnection dataConnection = new SqlConnection();
//dataConnection.ConnectionString = "Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4";
//dataConnection.Open();
//MessageBox.Show("connected");
SqlCommand dataCommand = new SqlCommand();
}
catch(Exception e)
{
Console.WriteLine("An error occurred accessing the database:" + e.Message);
}*/
}
SqlConnection dataConnection = new SqlConnection();
SqlCommand dataCommand = new SqlCommand();
//SqlDataReader sdr = new SqlDataReader();
/*private void button1_Click(object sender, System.EventArgs e)
{
SqlConnection dataConnection = new SqlConnection();
SqlCommand dataCommand = new SqlCommand();
dataCommand.Connection = dataConnection;
dataConnection.ConnectionString = "Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4";
dataConnection.Open();
//dataCommand.Connection = dataConnection;
//dataCommand.CommandText = "SELECT Emp#, Name, Designation, Department, Location FROM master";
dataCommand.CommandText = "select (@Emp#, @Name, @Designation, @Department, @Location)From master";
//textBox1.DataBindings.Add("Text", dataConnection.Database.s6w6q4.master,"s6w6q4.master.Emp#");
SqlDataReader datar = dataCommand.ExecuteReader();
while(datar.Read())
{
int empid = datar.GetInt32(1);
//textBox1.Text = Convert.ToString(empid);
string empname = datar.GetString(2);
string desig = datar.GetString(3);
string dept = datar.GetString(4);
string loc = datar.GetString(5);
}
}*/
private void Form1_Load(object sender, System.EventArgs e)
{
SqlConnection dataConnection = new SqlConnection();
dataConnection.ConnectionString = "Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4";
dataConnection.Open();
MessageBox.Show("Connected");
}
private void button1_Click(object sender, System.EventArgs e)
{
DataTable tbl_master = new DataTable();
dataConnection.ConnectionString = "Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4";
//SqlConnection conn_offers = new SqlConnection("Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4");
SqlDataAdapter da_offers = new SqlDataAdapter("SELECT 1 * FROM tbl_offers master BY NewID()", dataConnection);
da_offers.Fill(tbl_master);
}
}
}
with commented stuff.
i've tried various methods as can be seen, but nothing is helping n the project is due sunday.
this is what i want. a data table, called master, has been connected with my project.
it is a list of employees, and a ballot has to take place for a promotion. if that name would be dismissed, the button would be pressed again to retrieve another name, excluding the one that was chosen before.
i want to display the various attributes of the employee in textboxes. i hav no idea wat is happening anymore, i've been on this project for a week, n i regret i dint come here earlier.
im very very distressed. pls help me ASAP, pls get that code above right. n tel me how 2 kno if the connection is right.
as u can c, i've made the project so that as soon as the form loads, it tels me that a connection to database has been established. n it does so. but its not retrieving data. if i hav to display the data any other way, i will, but just help me outta this mess!
|
|
|
|
|
n the database is an excel file, btw.
|
|
|
|
|
what type of help you want .tell me
hi friends do somthing different........from other..........
|
|
|
|
|
Wajeeha wrote: HELP HELP URGENTLY!!!!
You might want to stick your head in a crocodile.
|
|
|
|
|
It would seem that you have committed the cardinal sin of demanding help urgently. If you need help urgently then there are various support options you can pay for. If you want help free then you have to wait until some kind volunteer has the time to assist you.
|
|
|
|
|
The best advice I can give you is to start your homework earlier and plan out better what you actually want to do. I find thinking about the task and even following the pseudo-code through on paper often helps to highlight problems in logic.
Maybe you could wait for John Simmons' answer if he sees the desperate request. I'm sure your phrase "n i regret i dint come here earlier." may well be slightly modified once you get his reply.
Also note that the words are "and" not "n", "see" not "c", "you" not "u", "I" not "i".
Your last rambling paragraph does not encourage the reader to continue but merely saps the will of the prospective helper.
I still remember having to write your own code in FORTRAN rather than be a cut and paste merchant being pampered by colour coded Intellisense - ahh proper programming - those were the days
|
|
|
|
|
Baconbutty wrote: but merely saps the will of the prospective helper
So that's what happened to me!
|
|
|
|
|
idiots like you also mean my post has been puched off the front page
|
|
|
|
|
idiots like you also mean my post has been pushed off the front page
|
|
|
|
|
Expect to fail the course.
|
|
|
|
|
I have a decimal number with a variable amount of digits following the decimal. I need to make the number a whole number and in doing so I need to keep track of how many decimal places there were.
ie change 28.9876 to 289874 and store there were 4 decimal places.
I am currently doing this by converting to a string and checking how many are after the '.'
This seems a poor way to solve this problem, but I am drawing a blank on other approaches. Can anyone offer other more efficient/elegant solutions?
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
I'm sure there is an even better way, but...
decimal d = 10.1234;
int dp = (d - decimal.Truncate(d)).ToString().Length - 2;
int val = (int)(d * (decimal)Math.Pow(10, dp));
This method, although still converting it to a string, doesn't 'search' the string for a particular character... just gets its length... which is relatively efficient.
As I said... there will be a better way... what it is I cannot immediately say.
Hope this helps.
Matthew Butler
|
|
|
|
|
For instance
decimal d = 28.9876M;
int[] bits = Decimal.GetBits(d);
int pow = (bits[3] >> 16) & 0xFF;
At the end pow contains 4 , i.e. the number of digits after the decimal point.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Appreciate the help
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
|