|
The ListView in .NET 2.0 will support this, but for now you should read the documentation[^] for List-View controls - the Windows Common Control that the ListView class encapsulates. You can also only do this on Windows XP because it requires you to bind to the Common Controls 6 library, which is a Win32 side-by-side (SxS) assembly only for XP and above.
To bind to CC6 in .NET 1.0, read my article[^]. For .NET 1.1, you can do the following for your entry point method:
static void Main()
{
Application.EnableVisualStyles();
Application.DoEvents();
Application.Run(new Form1());
} You then need to P/Invoke SendMessage and declare several structs, like the LVGROUP struct and LVITEM - as if _WIN32_IE were set to 0x560 or above (read the documentation I linked and you'll see what I mean) - in order to 1) define groups, and 2) put ListViewItem s in a particular group. There's a lot to do, and knowledge about native Windows programming with the Common Controls is practically required.
For a decent article and sample code, see the article C# ListView 1.3[^] (a.k.a. "Glacial ListView").
For information on what's in the Whidbey (.NET 2.0) beta regarding this issue, see http://msdn2.microsoft.com/library/System.Windows.Forms.ListViewItem.Group[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I believe you're going to have to P/Invoke in order for it to work. The ListView doesn't expose any way to deal with it.
--
Joel Lucsy
|
|
|
|
|
I want to know what are the classes that enable me
to controle by resource in C# like printer,flopy,cd room ,scanner,...
thanks.
|
|
|
|
|
You're going to have to be a little more specific than that. If by "controle" (actually, "control") you mean to print to a printer, then read the documentation[^] for the System.Drawing.Printing namespace classes. There's lots of examples in there was well.
To access a floppy you use one of the System.IO classes - like the FileStream - to open a file on, for example, your "A:\" drive just like you would any other file (that's what an operating system is supposed to provide - transparency). Same goes for a CD-ROM.
For a scanner you'll need to search[^] for something like "C# twain driver". There may be some articles on this site as well, but you'll again have to search using the text box at the top of every page underneath the logo. Research is part of development.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi everyone,
I am using a view in SQL server as a filter in order to show only a subset of rows to the user (depending on specific rights noted in a separate table).
At the same time I make use of the SqlCommandBuilder because I do not need any specific control over the sql statements.
This works nicely as long as select rights are granted to the user to both the view AND the underlying table. If I switch off the select right on the table (which is why I am doing this in the first place) the CommandBuilder cant find the schema information necessary to build the commands.
Now: The necessary schema information is present in the program in the form of a dataset containing all the tables, PKs and FKs (it gets the information at design time, no need to access the DB at runtime).
Does anyone have an idea how I can convince the SqlDataAdapter or the SqlCommandBuilder to make use of this information rather than to retrieve it from the server?
Anything that would save me writing tons of dumb sql-statements would be greatly appreciated!
hajo
|
|
|
|
|
SELECT privileges are still required on the table. A view is just a view on that table.
If you look at the documentation for the SqlCommandBuilder - or better yet look at the IL using ildasm.exe for the System.Data.dll assembly - you'll see that it only gets its schema information from the database. To do otherwise could pose a problem. While you may give correct schema information using a DataSet schema, someone else may not.
If the SqlCommandBuilder doesn't suit your needs, implement the other SqlCommand instances for the SqlDataAdapter yourself. It's not difficult.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Heath Stewart wrote:
SELECT privileges are still required on the table. A view is just a view on that table.
In the general case, this is not true; shielding the underlying table from direct user interaction is one reason that views exist.
In the specific case of a commandbuilder, it might be true due to the way the commandbuilder queries metadata about the underlying table.
|
|
|
|
|
Thanks a lot for the confirmation of what I thought I had found in the documentation (but was not sure I had found everything).
>While you may give correct schema information using a DataSet schema, >someone else may not.
That's true but since I do have the schema information it would be so much easier
I could even provide it in XML-Schema form directly if only the SqlCommandBuilder would be ready to accept it!
>If the SqlCommandBuilder doesn't suit your needs, implement the other >SqlCommand instances for the SqlDataAdapter yourself. It's not difficult.
Now, the SqlCommandBuilder suits my needs perfectly especially in that I can chose to use optimistic concurrency if I want to. I will certainly attempt to write my own commandbuilder rather than writing tons of discrete sql statements if only for ease of future adjustments necessary with every change in the DB.
Could you perhaps point to any sort of sample code (or any source code publicly available)that would help to jump-start that piece of work? [I have seen some pieces of code on the web but I don't seem to be able to remember the place; had something to do with the ".Net-for-Linux" project]
Thanks anyway, even knowing for sure that a solution is not feasible helps a lot!
hajo
|
|
|
|
|
Start by looking in the .NET Framework SDK[^] (which is also installed locally with VS.NET by default, along with the standalone .NET Framework SDK from http://msdn.microsoft.com/netframework[^]) to see what interfaces and/or abstract classes the SqlCommandBuilder implements or extends, respectively. Read about those interfaces and/or classes.
To see how the SqlCommandBuilder works, if you know how to read IL use ildasm.exe from the SDK or download .NET Reflector[^]. This will give you insight into how it works, which should help you figure out how to change it (or, rather, derive your own) to better suit your needs.
Another approach is to create a sample project and use the designer to design all your commands (which actually uses the command builders at design time), tweak the generated source code, and copy that into your current project.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks a lot, Heath!
That should be enough to get things started.
Hajo
|
|
|
|
|
Hello,
I am really sorry for this stupid quesiton.But I am very new at .NET.
I have a solution that includes two windows applications.I would like to open the second application based on the first application.How can I do this?
I want to open a windows forms belongs to second windows application.
How can I establish a relationship between these two windows applications?
PLEASE HELP
|
|
|
|
|
Not sure if you can just make a reference between 2 winforms projects (just tried and it won't let me).
What you could do is open and run the 2nd EXE using the Process object and perhaps pass in a command argument that will show the desired form instead of the main created in void Main().
Does this help?
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards "Most of us are programmers, but a few use VB", Christian Graus
|
|
|
|
|
Thank you very much for your attention.
I will load the language information based on the windows application1.
At the first application I am choosing the language info and then I would like to open the second windows application by clicking the Next button of Form1(Windows Application1)..
But how?
Again thank you..
private void button1_Click(object sender, System.EventArgs e)
{
if (radioGerman.Checked || radioItalian.Checked || radioRussian.Checked)
{
MessageBox.Show("JUST ENGLISH PLEASE","ATTENTION");
}
else
{
MessageBox.Show("----------") ;
//OPEN THE SECOND WINDOWS APPLICATION FORM1
}
|
|
|
|
|
Is there a specific reason that made you create a separate windows application for both forms?
The Form1 of your first windows application doesn't do much, so I don't see the point of creating a separate windows application for it.
www.troschuetz.de
|
|
|
|
|
I agree with Stefan. If you want to develop localized applications .NET includes a much better mechanism for sharing code with different regional (locale) settings and different UI languages. Read Developing World-Ready Applications[^] in the .NET Framework for more information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I have made a windows service which I want to install on other machines.So far I have done the installation by using the installutil.exe. But this method is cumbersome.Is there any shortcut method to do this.
Can I install my windows service on a machine which doesn't have .net installed.
Waiting for your response,
Thanks.
|
|
|
|
|
What i do is just use a batch script.
As for the .Net, it depends on what your windows service is made in ^^
My thoughts are that if your going to use stuff dependent on the framework then yes, your going to need the framework.
Hope this helped,
|
|
|
|
|
Esmo2000 wrote:
What i do is just use a batch script.
And then you have no uninstall capabilities. There are much better tools available.
Esmo2000 wrote:
My thoughts are that if your going to use stuff dependent on the framework then yes, your going to need the framework.
It's not your thoughts - it's a requirement. .NET applications won't run without the .NET Framework, just like Java apps won't run without a JVM and the JRE, VB6 apps won't run without the VB VM, etc.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
just_starting wrote:
I have made a windows service which I want to install on other machines.So far I have done the installation by using the installutil.exe. But this method is cumbersome.Is there any shortcut method to do this.
Add a new Windows Installer project to your solution and add your EXE assembly to whatever directory you want to register for the path to the service. Click the View -> Editor -> Custom Actions menu. Right-click on the root node and select Add Custom Action. Find your DLL you added to the File System editor and compile. This will run the Installer derivative in your Windows Service assembly automatically.
just_starting wrote:
Can I install my windows service on a machine which doesn't have .net installed.
If your Windows Service is managed, then no. .NET applications require the .NET Framework, just like Java apps require a JVM and probably the JRE, MFC applications require the shared MFC library (unless you statically link and bloat your application), VB6 apps require the VB virtual machine, Perl scripts require the Perl runtime, and the list goes on and on.
To deploy the .NET Framework with your Windows Installer package - because it won't do it out of the box for you, read Creating a Single SEtup Project to Install a .NET Framework Application and Dotnetfx.exe[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I tried the method you specified but was still unable to install the service. It is still asking to install it using InstallUtil.exe.
help needed..
|
|
|
|
|
You must make sure that you have a class that derives from Installer and that it is attributed with the RunInstallerAttribute with true as the parameter.
When you add the assembly to the Custom Action view - while it should be automatic - make sure that the "InstallerClass" (or something like that) is set to True.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I'm tring to add a row at my database .mdb but i get the follow error: "Sintax error in the INSERT INTO instruction" why? what do i wrong?
this is the schema of my database:
Nome: text 15
Domanda: text 20
Risposta: text 15
Email: text 20
this is the code:
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data source= myDatabase.mdb;";
try
{
conn.Open();
OleDbDataAdapter myAdapter = new OleDbDataAdapter("SELECT * FROM myTable", conn);
OleDbCommandBuilder myCmd = new OleDbCommandBuilder(myAdapter);
DataSet myDataSet = new DataSet("myTable");
myAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
myAdapter.Fill(myDataSet, "myTable");
DataRow myRow = myDataSet.Tables["myTable"].NewRow();
myRow["Nome"] = mNuovoUtente.mName;
myRow["Domanda"] = mNuovoUtente.mQuestion;
myRow["Risposta"] = mNuovoUtente.mAnswer;
myRow["Email"] = mNuovoUtente.mEmail;
myDataSet.Tables["TabellaUtente"].Rows.Add(myRow);
myAdapter.Update(myDataSet, "myTable");
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
|
|
|
|
|
please can someone answer me?
|
|
|
|
|
Well, the first problem is that your table doesn't show a primary key. Without it, .Update() won't work. Second, you, apparently, don't have an Update command associated with the DataAdapter. Third, if the Primary Key information is missing, you set the .MissingSchemaAction , but never called .FillSchema before you called .Fill .
You last problem is coming back here demanding an answer to your problem. We do this in our spare time and don't get paid to do it. If you don't like the speed at which the developer community answers your questions, take it up with our supervisors! Oh! Sorry, we don't have any supervisor here! We're just a bunch of volunteers... :->
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave Kreskowiak, i thank you for your answer but i don't understand why you tell me that.
The only thing i tryed to do was avoid to make my thread disappear, infact right after some minutes other user with their posts have make my post jump at the second/third page and i thought the volunteer could not see it.
Sorry for that, anyway could fit my code with what i've missed?
Really thanks.
|
|
|
|