|
A simple example.
Suppose you have a dataSet that contains data from a couple of tables located in a Database. The following code snippet will loop through each of the records in the FIRST table of the dataSet and will display the values of the fields username and password, for each record (row). I know it's a silly example since it doesn't make a lot of sense to do something like that, but it demonstrates the way for accessing the rows in a table:
DataTable <code>dt</code> = dataSet1.Tables[0];
for(int <code>i</code> = 0; i < dt.Rows.Count; i++)
{
this.textBox1.Text.Trim() == dt.Rows[i]["Username"].ToString().Trim();
this.textBox2.Text.Trim() == dt.Rows[i]["Password"].ToString().Trim();
}
Hope this helps
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Good day to all of you, I'm an intermediate C# programmer, and I'm trying to help my friend who has a small computer rental for the monitoring of the pc use, mostly for gaming/internet. As of now, he is confined to writing all in a record book and do all by hand, so I want every computer to have a small window that has their time remaining before the computer logs off or hibernate, the workstations are being controlled by the server in the cashier. The problem is how can I access the workstations for me to control it in the server and to place small windows in them. Somebody told me that it can be done using winsock. This is my first time to handle a network related application using C#. Thanks in advance.
|
|
|
|
|
You can probably do it with a quick script but...
If you want to use c# the fastest way is to create a client / server app using remoting.
|
|
|
|
|
How can I get the hardware profile of remote computer?
I am working on a web application which check visitor hardware profile and display it on the web... I have the problem of how can I make it run automatically without troubling the user to download it and run it on local machine.
|
|
|
|
|
I use this code to handle my event, but DoubleClick event not work.
Can some one help me?
thanks.
pictureBox.DoubleClick += new System.EventHandler(mouseDoubleClick);
pictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(MouseDown);
|
|
|
|
|
hi, i have tested it and it works. here are the 2 lines of my code
this.pictureBox1.DoubleClick += new System.EventHandler(pictureBox1_DoubleClick);
this.pictureBox1.MouseDown +=new MouseEventHandler(pictureBox1_MouseDown);
Make sure u get the sender and event args and no exception is skipping ur code.
I made a pic box which changes the location on double click and changes image in mouse down , show the methods code to see whats wrong.
|
|
|
|
|
Thanks for your answer.
there are my code it's a thumpnails image.
method doubleclick for open image.
and mousedown for dragdrop image to my other panel.
pictureBox.DoubleClick += new System.EventHandler(mouseDoubleClick);
pictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(MouseDown);
public void MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
PictureBox pb=(PictureBox)sender;
pb.DoDragDrop(filename,DragDropEffects.Copy);
}
public void mouseDoubleClick(object sender, System.EventArgs e)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName=filename;
proc.Start();
}
|
|
|
|
|
as topic, how to write a loading screen when my system is doing something like loading the sql statement, crystal report or datagrid?the loading screen will automatically show during loading, then it will automatically close when the loading is complete, anyone can provide some coding on this? ur help is greatly appreciated..;)
|
|
|
|
|
I have a form which has more than 10 combobox controls and all should be filled from a different fields in different tables in one mySQL database. I want to do this using the code and not at design time because I have the connection setting in the registry.
what is the best way to do it (with example please) to make sure the form loadng won't be too slow..
Many Thanks,
Jassim Rahma
|
|
|
|
|
Hi jrahma,
Get the rquired fileds from Database into a Dataset or data table. Set the Datasource , DataMember, Value member properties of the combobox control to the right columns in your dataset or table.
Thanks and Regards
SGS
|
|
|
|
|
I have an MDI child for and I want it to be shown maximized with preventing the user from clicking on Max, Min or X buttons on the control box.
Jassim Rahma
|
|
|
|
|
To show MDI child as maximized, set the "WindowState" property to the value of "Maximized".
If you do not want to show the Max button, set the "MaximizeBox" property to "False".
For not showing the Min button, set the "MinimizeBox" property to "False'.
Likewise, if you do not want to show the X button (i.e., close button) on the child form, you can set the value of "ControlBox" as "False".
|
|
|
|
|
Hi Ashok,
I've tested your suggestion. But it still allows me to minimize the child form. Guess we need to do something more to prevent that.
Thanks and Regards
SGS
|
|
|
|
|
There's the SizeChanged event that will tell you when the window size has changed (minimized or maximized.) There's not a SizeChanging event to cancel the resizing that I could find, but you could immediately re-maximize your window (I don't know about flicker.)
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Use the following code (i.e., in the Load event of the Child form). It should solve your problem, as I could test in my sample program. This code will give you a child window with no Max, Mix, Close (i.e., X) buttons and with fully maximized child window, as desired by you. You can still access other child windows from the Window menu of the MDI Parent window which displays links to different child windows.
private void ChildWindow_Load(object sender, System.EventArgs e)
{
this.Dock = DockStyle.Fill;
this.FormBorderStyle = FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.ControlBox = false;
}
|
|
|
|
|
Ok , this time I think it is a logic error r smth... her eis the full code:
private void Tamam_Click(object sender, System.EventArgs e)
{
SqlCommand myCommand = null;
myCommand = new SqlCommand("INSERT INTO CES VALUES(@i_cesit,@i_uzunluk,@i_capı,@i_uzunlugu,@i_kavisi,@arayuz,@kod,@stok,@g_fiyat,@s_fiyat)",Form1.myConnection);
try
{
myCommand.Parameters.Add("@i_cesit",SqlDbType.VarChar);
myCommand.Parameters["@i_cesit"].Value = ıplık_cesıtı.Text;
myCommand.Parameters.Add("@i_uzunluk",SqlDbType.Int);
myCommand.Parameters["@i_uzunluk"].Value = ıplık_capı.Text;
myCommand.Parameters.Add("@i_capı",SqlDbType.VarChar);
myCommand.Parameters["@i_capı"].Value = ıplık_capı.Text;
myCommand.Parameters.Add("@i_uzunlugu",SqlDbType.Int);
myCommand.Parameters["@i_uzunlugu"].Value = (ıgne_uzunlugu.Text);
myCommand.Parameters.Add("@i_kavisi",SqlDbType.VarChar);
myCommand.Parameters["@i_kavisi"].Value = ıgne_kavısı.Text;
myCommand.Parameters.Add("@arayuz",SqlDbType.VarChar);
myCommand.Parameters["@arayuz"].Value = ara_yuzu.Text;
myCommand.Parameters.Add("@kod",SqlDbType.VarChar);
myCommand.Parameters["@kod"].Value = urun_kodu.Text;
myCommand.Parameters.Add("@stok",SqlDbType.Int);
myCommand.Parameters["@stok"].Value = (stok_mıktarı.Text).ToString();
myCommand.Parameters.Add("@g_fiyat",SqlDbType.Float);
myCommand.Parameters["@g_fiyat"].Value = (bırım_fıyatı.Text);
myCommand.Parameters.Add("@s_fiyat",SqlDbType.Float);
myCommand.Parameters["@s_fiyat"].Value =(bırım_fıyatı.Text); myCommand.ExecuteNonQuery();
}
catch (Exception a)
{
MessageBox.Show(a.ToString());
}
}
It keeps giving an error like :
"System.FormatException: Input string was not in a correct format.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at CES.urun.Tamam_Click(Object sender, EventArgs e) in c:\documents and settings\şirin baba.aikanaro.002\desktop\ces\urun.cs:line 587"
o.k , what can be the problem , according to the articles found in net , there is nor mistake.. Has any one any idea?
Thanks a lot..
|
|
|
|
|
Asked and answered below in your other post.
There are plenty of mistakes...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Someone please send me a code to read a binary file. The code should then change the first 2 bytes to hexadecimal codes..... the next 4 bytes to decimal.... the rest of the file can be in any format...... It should take the name of the file as a command line parameter...
|
|
|
|
|
Sorry, you have to write it yourself. If you have a specific problem, then you can come here and ask about it. We won't write the code for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Prakash,
Create a binary reader by passing any stream that is created on the file. (Which you recieved through command line parameter). Use the binary readers read method to read the content into a byte array. You can use the Byte array's ToString method to convert the content to the necessary format.
fs = File.OpenRead(@"your file name");
BinaryReader br = new BinaryReader(fs);
byte[] buffer = new byte[32768];
int read= br.Read(buffer,0,buffer.Length);
mybytearry[0].ToString("X")---hexa decimal
Guess this will help you.
Thanks and Regards
SGS
|
|
|
|
|
Some please send me a code to read a binary file. The code should then change the first 2 bytes to hexadecimal codes..... the next 4 bytes to decimal.... the rest of the file can be in any format......
|
|
|
|
|
Hmm.. sounds like a homework project to me.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
In the tree of the WindowsExplorer, when we click on a node and choose 'rename', the text of that node, maybe, appear in a textbox and we can change that text.
Can u show me how to do that in C#?
Please help me!
Thank you in-advanced!
|
|
|
|
|
gyokusei wrote:
Can u show me how to do that in C#?
So, what you are saying here is that you want to simulate this effect on a listview control (or similar controls) into your application (WinForms I suppose)? Or you want access the shell?
Regards,
Polis
Can you practice what you teach?
|
|
|
|