|
Hello!
I need to set permissions to keys in the registry... I read something about it in
this site, but I really don't understand how to set permissions...
I would be very thankful if someone could help me...
Thanks in advance!
|
|
|
|
|
The best place to ask would be in the forum at the bottom of the page that the article you read this on. The author would most likely know, or perhaps it has already been anwered there.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I agree, but still, maybe someone knows?
|
|
|
|
|
This can't be this difficult! I created 2 datagridviews where dg1 displays the parent table and dg2 the child table. Selecting and updating records is not a problem. The problem comes when I try to insert records.
I'm using MySQL 4 and Visual Studio 2005. I write in C#. I'm fairly new to C# and the whole .NET "thing" so I don't know if this is the right board but I figured I'd give it a shot.
If I want to insert a new record, I have to insert the parent record first. Update it. Close the app. Re-launch it. And then I can insert my child records in the recently created parent record. Also, only one new parent record at a time. I know this is ridiculous but it's the only way I can insert to the db.
Any ideas?
MySQL db:
Parent table: tbl_parent
id int(10) not null auto_increment,
name varchar(40),
primary key(id)
Child table: tbl_child
id int(10) not null auto_increment,
ref_id int(10),
name varchar(40),
cost float(4,2),
primary key(id),
foreign key(ref_id) references tbl_parent(id)
on update cascade
on delete cascade
As for my C# code:
**Note: this is just one of many messes I've made!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace MySql
{
public partial class Form1 : Form
{
//
private OdbcConnection cnn;
private OdbcDataAdapter da0;
private OdbcDataAdapter da1;
private BindingSource bsMaster = new BindingSource();
private BindingSource bsDetails = new BindingSource();
private OdbcCommandBuilder cb0;
private OdbcCommandBuilder cb1;
private DataSet ds = new DataSet();
//
public Form1()
{
InitializeComponent();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnConnect_Click(object sender, EventArgs e)
{
this.dg1.DataSource = bsMaster;
this.dg2.DataSource = bsDetails;
this.GetData();
}
private void btnUpdate_Click(object sender, EventArgs e)
{
//not sure which one to use
//DataSet changes = new DataSet();
//changes = ds.GetChanges();
//this.da0.Update(changes, "meal");
//this.da1.Update(changes, "details");
//this.ds.AcceptChanges();
//
this.Validate();
this.bsMaster.EndEdit();
this.da0.Update(ds, "meal");
this.da1.Update(ds, "details");
this.ds.AcceptChanges();
}
private void dg1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
}
private void GetData()
{
string user = txtUser.Text;
string pwd = txtPwd.Text;
string cnnString = @"DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=localhost;DATABASE=mydb;" +
"USER=" + user + ";PASSWORD=" + pwd + ";OPTION=3";
if (cnn != null)
cnn.Close();
try
{
this.cnn = new OdbcConnection(cnnString);
this.da0 = new OdbcDataAdapter("select * from tbl_parent order by name", cnn);
this.da1 = new OdbcDataAdapter("select * from tbl_child", cnn);
this.cb0 = new OdbcCommandBuilder(da0);
this.cb1 = new OdbcCommandBuilder(da1);
this.da0.Fill(ds, "main");
this.da1.Fill(ds, "details");
DataRelation rel = ds.Relations.Add("maindetails",
ds.Tables["main"].Columns["id"],
ds.Tables["details"].Columns["ref_id"]);
this.bsMaster.DataSource = ds;
this.bsMaster.DataMember = "main";
this.bsDetails.DataSource = bsMaster;
this.bsDetails.DataMember = "maindetails";
}
catch (OdbcException ex)
{
MessageBox.Show("Error while connecting: " + ex.Message);
}
}
}
}
|
|
|
|
|
Hi,
I'm working on a project that may require us to display a WinForm-based control in an ASP page. I have found examples of how to do so -- Raul Alonzo's article, for example, was very helpful: http://www.codeproject.com/cs/miscctrl/htmlwincontrol.asp[^]
I have been able to make this work using VS 2003 and the 1.1 Framework. This project will be done with VS 2005 and the 2.0 Framework, though, so I'm trying to do it there as well. The problem I'm having is that the control simply refuses to display. I do not get an error message or the little control icon, just an empty box.
Here is the Object tag I have in my ASP:
<object id="WFTControl" classid="Bin/WindowsCalendar.dll#WindowsUC.HelloWorld" style="width: 570px; height: 431px">
The HelloWorld control is simply a C# user control with a single button that, when pressed, changes its text to "Hello World".
Has anyone else tried this under 2.0? Is there something different I need to do?
Thanks in advance,
Doug
|
|
|
|
|
hi,
i'm trying to get values of the properties with property info (pi) class. if statement controls the pi.CanRead,
if pi.CanRead then
pi.GetValue(obj, nothing)
end if
(this is just an example)
it's working properly except "FileIOPermissionAttribute.ViewAndModify" and "FileIOPermissionAttribute.All"
it gives error on these two property "The 'get' method is not supported on this property." but it supports...
how can i fix this problem? thanks all..
|
|
|
|
|
Hi,
I don't know (and couldn't find even I searched hard) the ViewAndModify property but the All property if FileIOPermissionAttribute just throws a NotSupportedException in its getter implementation (you can see this using reflector on it).
This is probably because when you set All you implicitely set the values for Append, PathDiscovery, Read and Write to the same value. The All getter would have a problem when those properties would have different values.
|
|
|
|
|
Hi,
I am converting a ContextMenu from an existing app to ContextMenuStrip. I got around the problem of not having a Clone method handy, but I haven't found a way to implement the DefaultItem behavior that came with the old MenuItems.
Any suggestions would be appreciated.
Thanks
|
|
|
|
|
Hallo
i need to open some forms of a VB6 application from a .NET one; i have written both, so i have the source code and know the source names of the forms.
What should i do?
Are the forms accessible via their source code names? Eg. in a way like Form1.show etc.
Thanks in advance
|
|
|
|
|
The two apps don't know anything about each other. The forms in one are not going to be available to the other at all, let alone by the names you used in the source code.
What are you really trying to do with this?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ok thxalot for your feedback.
the situation is that i have a large VB6 application running, and i'd need to implement new forms/new functions that would be easier to code in .NET, or at least possible only in .NET. But i'd like the user to have the impression to use only one application: i.e. the VB6 app still run in foreground while the .NET runs in background and its forms are shown only when needed, or viceversa or something like that.
|
|
|
|
|
If you compile your VB6 application as an ActiveX Exe you can implement a public function in a public class which opens your form.
It should be no problem to convert your project if it isn't already an ActiveX Exe project.
After this you can bind your exe in the .net application and use the class to open the form.
Ingo
|
|
|
|
|
Hi
I've been asked to associate a file extension to my program, so that
the user can double.click a .aaa file and my programs starts
immediatly reciving the file name and path as command line
parameter.
How can I do it in installation (or via code)
Ciao
Marco
|
|
|
|
|
You should create a registry key. If you're using fw 1.1 you can use the OpenNetCF Library to do this.
Creating a file extension association should then be the same like doing it for windows.
Ingo
|
|
|
|
|
Hi
I'm developping a WinCE 5.0 app using VS 2003, C# and CF 1.0 SP3.
I'm currently testing on the WinCE 4.1 Emulator but a quick check on the
CE 5.0 Device confirmed the behaviour.
I create a full screen Form setting:
<br />
ControlBox = False<br />
FormBorderStyle = None<br />
WindowState = Maximmized
I add 3 buttons (button1, button2, button3) and add the following :
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
this.Controls.Clear();<br />
}<br />
<br />
private void Form1_Click(object sender, System.EventArgs e)<br />
{<br />
this.Controls.Add(button1);<br />
this.Controls.Add(button2);<br />
this.Controls.Add(button3);<br />
this.Refresh();<br />
<br />
}<br />
As you see I clear the controls with the first button and then try to
reasign the 2 controls to the form on the OnClick event of the form.
Guess what happens ?
No controls appear on the first clieck, button2 and button3 on the second
click and all of them on the third click.
But there's more:
The controls don't show, but they are there: I click where I remeber the
control was and I get the button.OnClick event !!!!!!
As you see I've tried everithing I know (visible, invalidate, refresh etc
etc) but I allways get the same behaviour.
Do you know how I can get the right behaviour ?
I found a workaround, but I'm still looking for the right solution.
the workaround is:
private void button1_ParentChanged(object sender, System.EventArgs e)<br />
{<br />
(sender as Control).Visible = ((sender as Control).Parent != null);<br />
<br />
}<br />
So the buttons turn invisible after the Controls.Clear() and return visible
after the Controls.Add().
Please note that this is just a TEST APP, the real app must asign
dinamically the controls so Controls.Clear() and Controls.Add() MUST be used
Please Note: if I don't set the FormBorderStyle = None property then
everything works perfectly !!!
Please help
Ciao
Marco
|
|
|
|
|
Did you tried to use 'new' :
button1 = new System.Windows.Forms.Button()
Another question: why do you clear them from their parent. You could set them invisible, setting them visible again shoudl work without problem.
I can't test your code, because i've just got Windows CE 4.0.
Ingo
|
|
|
|
|
[quote]
Did you tried to use 'new' :
button1 = new System.Windows.Forms.Button()
[/quote]
I don't need to create a new button..it's already there, I just need to
set it's parent.
Visible works but I need to get 'em off the parent form completely
Thanks for the effort
|
|
|
|
|
Yes I know that it's there. But if you use the constructor there should be no problem. If there is a problem they way you tried, it sounds a little bit like a bug to me. So I would try something different.
Ingo
|
|
|
|
|
Iwant to ask about the combobox, How i can have the opportunity tochoose one of the alternative in the combo without clicking the arrow.
i mean whaen i begin writing the first letters, it gives me all the opportunity inside, So t can choose.
Thanks...
Assaf
|
|
|
|
|
The combo box does not support auto complete, but there are controls around that do, search this site and see what you come up with.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello! I need to make some search in the registry...
I need to find all the keys and the values that include some word, and to delete
them... I know there is a class Registry, but I don't know how to do what I need.
Maybe someone could help me?
Thanks!
|
|
|
|
|
There are the Registry-Class and the RegistryKey Class
You can get all RegistryKey-Names with a funktion in the RegistryKey-Class:
string[] name = Registry.LocalMachine.GetSubKeyNames();
you can open every subkey and on this you can get all SubKeyNames of this Subkey.
So you can look up every Key, Check its values and if you like Delete it with the Funktion DeleteSubKey
Ingo
|
|
|
|
|
These classes are found in the Microsoft.Win32 Namespace of the .NET Framework.
Bikash Rai
|
|
|
|
|
Oh sorry!
I were thinking of WinCE designing. You're totally right. It's in the Microsoft.Win32 namespace
|
|
|
|
|
Hey Guys,
Been playing with MSH & WinFX and put together a little MSH script to build all projects on your machine which you may find helpful (especially for building the samples)
MSH> $files = (dir . *.csproj -Recurse)<br />
MSH> foreach ($file in $files) {<br />
cd $file.Directory.FullName;<br />
msbuild;<br />
}
60% of statistics are made up on the spot
|
|
|
|