|
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.
|
|
|
|
|
|
Michael P Butler wrote: What is wrong with the above code?
Nothing!
But does it make sense to convert into its own type? or do we have need for it?
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
Hi,
Iam new to c# ,is it possible to create a tool strip which can be moved to the middle of the form (similar to the toolstrips present in microsoft products),using vs2005.
thank you,
Regards
praveen
|
|
|
|
|
Hello,
I'm getting the following exception when I'm running my app:
SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.
I followed I tutorial to create a splash screen and my Program.cs file has been changed to:
static class Program
{
private static ApplicationContext context;
private static SplashForm sForm = new SplashForm();
private static MainForm mForm = new MainForm();
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
context = new ApplicationContext();
Application.Idle += new EventHandler(OnAppIdle);
sForm.Show();
Application.Run(context);
}
private static void OnAppIdle(object sender, EventArgs e)
{
if (context.MainForm == null)
{
Application.Idle -= new EventHandler(OnAppIdle);
mForm.PreLoad();
context.MainForm = mForm;
context.MainForm.Show();
sForm.Close();
sForm = null;
}
}
}
Everything is working fine, except when I uncomment this line:
Application.SetCompatibleTextRenderingDefault(false);
I get the exception mentioned above.
How can I solve that?
Thanks in advance.
|
|
|
|
|
The tutorial is wrong or you did not follow it correctly. Never had that probelem but from the code and the error message I would guess you can't have statically constructed forms if you want to call SetCompatibleTextRenderingDefault().
make sure you post the solution when you find it.
"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
|
|
|
|
|
This is the tutorial:
http://www.codeproject.com/csharp/apploadingarticle.asp
It was written for .NET 1.1 and I tried to convert it to version 2.0. I just didn't create a class named: AppLoader I used Program.cs instead.
Thanks.
|
|
|
|
|
Hi,
What is the difference between value types and structs in C#?
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|