|
i have 5 groupboxes in one form.
each group box has 3 textboxes and two buttons
the first textboxes of each groupbox are from a dataset coming from a master lists.
for example a productcode.
the other two textboxes are the details of the productcode coming from another table from the database which primary code is the productcode
the two buttons functions as the following:
first button(arrow down)
it will display the data from that of the groupbox 2 to the controls of the groupbox 3
and the data from the groupbox 3 to groupbox 2
second button(arrow up)
it will transfer the data from that of the groupbox 3 to the controls of the groupbox 2
and the data from the groupbox 2 to groupbox 3
its sort of changing the displayed data either up or down of the other groupboxes
|
|
|
|
|
how can i make a C# windows application?
|
|
|
|
|
Write the code and compile it? What problem do you exactly have?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Create a new WindowApplication project from the File->New->Project Menu
|
|
|
|
|
Your previous questions are about complexe things. But you don't know how to create a windows application ?????
|
|
|
|
|
hi all,
i want to ask a few questions, and hope to get answers.
1. how can i find a process' owner? (like system or local service or network service or current user)
2. how can i find the cpu usage of a specific process?
3. to start a specific process, how can i list 'the installed programs' in a list or combobox to let the user select one to start ?
4. how can i check if a process is already started ?
many thanks in advance,
bye.
|
|
|
|
|
Hello
Mehmet Fatih Akbulut wrote: 1. how can i find a process' owner? (like system or local service or network service or current user)
Check the Process.StartInfo.UserName Property
Mehmet Fatih Akbulut wrote: 2. how can i find the cpu usage of a specific process?
I don't think you can -or maybe I just don't know!!-. CPU usage is variable over time. Yet you can get the memory usage. check the Process class members.
Mehmet Fatih Akbulut wrote: 3. to start a specific process, how can i list 'the installed programs' in a list or combobox to let the user select one to start ?
Check this Registry Key:
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
Each subkey represent an installed application. Check the DisplayName value of each.
Mehmet Fatih Akbulut wrote: 4. how can i check if a process is already started ?
I've posted an article for this, but i deleted it recently -Sorry!!-. You can search CP for "single instance" maybe you will find something.
|
|
|
|
|
Hi,
Description: I had to create a C# ActiveX to work in IE (without an IIS server, so I can't use the option of showing window forms in IE). My final project output does not only exists out of the C#/ActiveX dll but also some referenced third party dlls (not ActiveX, just .NET).
The app works, when I compile it for COM interop and then add the right <object> tag in an html file it works fine. But in order to redistribute the app I need to enter something in the codebase parameter of the object tag. This is a CAB file.
Problem: I tried to add a CAB setup project to my solution, but when I compile my project, and the CAB gets build, it only adds the C#/ActiveX dll to my CAB file and NOT the referenced dlls (who don't have to be registered as a COM object but just have to sit in the same directory as the C#/ActiveX dll).
Pointers: Can I use some sort of normal setup, an exe file, as codebase? or how do I setup the inf file in the CAB to do what I want? Did anybody else run into this problem?
thanks,
Gidon
|
|
|
|
|
I wrote this code to populate a treeview with two different objects, customer and customer groups. My first ever "recursive funtion" and its awfull. In a few weeks it will take me a few hours to figure out what this all does, so could somebody help me clean this up...
<code>
(private customTreeNode node in class declaration)
private void createTree()
{
treeCustomers.Nodes.Clear();
if (customerGroups == null)
return;
else
{
foreach (customerGroup group in customerGroups)
{
if ((group.getGroupParentID() == 0) || (group.getLevel() == 1))
{
node = null;
node = new customNodeObject(group);
ArrayList list;
list = findClient(group.getGroupName());
if (list != null)
{
foreach (customNodeObject c in list)
{
customNodeObject newerNode = c;
newerNode.ForeColor = Color.Green;
node.Nodes.Add(newerNode);
}
}
loopNodes(customerGroups, (group.getLevel() + 1), group, node);
treeCustomers.Nodes.Add(node);
}
}
}
treeExpander();
}
private void loopNodes(ArrayList customerGroups, int previousLevel, customerGroup parent, customNodeObject node)
{
foreach (customerGroup group in customerGroups)
{
if ((group.getLevel() == previousLevel) && (parent.getID().Equals(group.getGroupParentID())))
{
int nextLevel = (previousLevel + 1);
customNodeObject newNode = new customNodeObject(group);
ArrayList list;
list = findClient(group.getGroupName());
if (list != null)
{
foreach (customNodeObject c in list)
{
customNodeObject newerNode = c;
newerNode.ForeColor = Color.Green;
newNode.Nodes.Add(newerNode);
}
}
node.Nodes.Add(newNode);
loopNodes(customerGroups, nextLevel, group, newNode);
}
}
}
private System.Collections.ArrayList findClient(String type)
{
ArrayList custTemp = new ArrayList();
foreach (customer cust in customers)
{
if ((type == cust.CustType) && (cust.UpdateStatus != "delete"))
{
custTemp.Add(new customNodeObject(cust));
}
}
return custTemp;
}
</code>
-- modified at 5:39 Wednesday 28th June, 2006
|
|
|
|
|
I'd like to draw something on a TabPage on PDA (using compact framework). I know that it can't be done the same way like in normal framework because there's no CreateGraphics function within the TabPage class (there is.. but it's not implemented). Is there any other way how to obtain Graphics object than to call CreateGraphics function ? or is it possible to draw on TabPage in completely other way ?
|
|
|
|
|
1. How can i create a folder in a particular path using c#.
2. I have sorted content in a dataview, how can i assign the content to data table.
Jey
|
|
|
|
|
Hi,
1. Directory.CreateDirectory(path);
2. You would have to manually crate a new DataTable and then copy the contents of the view row by row. What are you actually trying to do? You could for example directly assign the DataView to a DataGrid and it will show it like its currently sorted.
Robert
|
|
|
|
|
System.IO.Directory.CreateDirectory("c:\\one");
|
|
|
|
|
thanks Robert. Actually i am reading string content from the text file(.txt) using stream reader. I am copying all those data to data table for each column. after sorting the data by particular column, that sorted content should be assigned to data table and write it to output file(.txt) too. These operations should be done without using data set and data grid.
Jey
|
|
|
|
|
Do you really need to transfer the data int oa DataTable? You could directly write the contents of the DataView. I assume you are writing with a loop like:
foreach (DataRow dataRow in dataTable.Rows) {
}
If you have a DataView the equivalent code would look like:
foreach (DataRowView dataRowView in dataView) {
DataRow dataRow = dataRowView.Row;
}
The difference would only be the sorting.
Robert
|
|
|
|
|
How to connect a BlueTooth to a window application?
i am writing a windows application on sending images through bluetooth device connected to a PC to mobile phones. but i had problem in connecting to the bluetooth device using codes and how we are going to search for available devices and allow the users to select. Is there any available APIs where i can take reference?
|
|
|
|
|
Have a look at 32feet.net Peter Foot has spent alot of time getting the windows bluetooth api into an friendly dll.
Have a look, it also has lots of examples. Only drawback is that you have to have XP Service Pack 1 (or any operating system that comes with the Microsoft Bluetooth Stack) and that you have to uninstall your current drivers if they are not Microsoft.
It also has all the support for the MS Stack enabled pda's and smart phones that run the compact framework.
Gav
|
|
|
|
|
what is the difference between DataGrid and DataGridView?
|
|
|
|
|
The DataGrid was introduced with the first .Net framework version. The DataGridView was introduced with .Net 2.0.
There are many functionalities which are available in both grids. But both have also capabilities the other hasn't. One advantage of the DataGrid is for example that it can display DataTables of a DataSet which have relations (the user can naviagte through the different tables). The DataGridView has for example dynamic column reordering and better databinding.
Generally I'd prefer the DataGridView but it depends on your requirements which one fits better.
|
|
|
|
|
what do you mean by Dynamic column reordering?plz give an example
|
|
|
|
|
This means that the columns can be reordered by the user with drag & drop without actually modifying the underlying data source.
|
|
|
|
|
hi.i am struggling to insert name in the database using method.it gives me this error "Use of unassigned local variable 'empname'" and my code is as follows.
public void InsertValues(string empname1)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "integrated security=SSPI;initial catalog=Employee;server = za211149;persist security info=False";
conn.Open();
try
{
SqlCommand cmdInsert = new SqlCommand();
cmdInsert.Connection = conn;
empname = empname1;
cmdInsert.CommandText = "INSERT INTO jakes VALUES(@empname)";
cmdInsert.Parameters.Add(new SqlParameter("@empname",System.Data.SqlDbType.VarChar,50,"empname"));
cmdInsert.Parameters["@empname"].Value = empname.ToString();
if (cmdInsert.ExecuteNonQuery() !=0)
{
MessageBox.Show("Record inserted");
}
else
{
MessageBox.Show("record not inserted");
}
//return true;
}
catch(Exception E)
{
MessageBox.Show(E.ToString());
//return false;
}
finally
{
conn.Close();
}
}
|
|
|
|
|
The code you posted does not contain a declaration for the variable empname
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
actually my code is like this.
using System;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Windows.Forms;
namespace bb
{
///
/// Summary description for connection.
///
public class connection1
{
public string empname;
public connection1()
{
//
// TODO: Add constructor logic here
//
}
public void InsertValues(string empname1)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "integrated security=SSPI;initial catalog=Employee;server = za211149;persist security info=False";
conn.Open();
try
{
SqlCommand cmdInsert = new SqlCommand();
cmdInsert.Connection = conn;
empname = empname1;
cmdInsert.CommandText = "INSERT INTO jakes VALUES(@empname)";
cmdInsert.Parameters.Add(new SqlParameter("@empname",System.Data.SqlDbType.VarChar,50,"empname"));
cmdInsert.Parameters["@empname"].Value = empname.ToString();
if (cmdInsert.ExecuteNonQuery() !=0)
{
MessageBox.Show("Record inserted");
}
else
{
MessageBox.Show("record not inserted");
}
//return true;
}
catch(Exception E)
{
MessageBox.Show(E.ToString());
//return false;
}
finally
{
conn.Close();
}
}
}
}
|
|
|
|
|
Mamphekgo wrote: cmdInsert.Parameters.Add(new SqlParameter("@empname",System.Data.SqlDbType.VarChar,50,"empname"));
cmdInsert.Parameters["@empname"].Value = empname.ToString() ;
If I'm not wrong string type doesn't need conversion to string. Since it's already a string.
Initializing the variable empname with empty string might solve your problem.
Best of Luck.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|