|
Hope this[^] will help you
|
|
|
|
|
Hi I went through this earlier, based on that I tried many combinations, but while using Installutil, I dont know how can I specify the parameters
now I am using installutil /name="String" /key="value" <exe name="">
But it is not appearing as the parameter values of Main method
With Regards,
Abraham Chethuvelil
|
|
|
|
|
Hi,
I am writing a small program, where I need to transfer Excel Data into Access tables using C#.Net.If anyone has attempted this please be kind enough to help me on this.
Rameshi
|
|
|
|
|
Use the JET OLE DB Provider to connect to your spreadsheet. Loop through the data in the spreadsheet and run an INSERT query on your Access database for each row of data.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
You could also fill a datatable from from the excel spreadsheet (ExcelDT)
and also fill another datatable from the Access Table (AccessDT).
Then just use a foreach loop on the excel datatable:
foreach (DataRow row in ExcelDT.Rows)
{
DataRow newrow = AccessDT.NewRow();
newrow.ItemArray = row.ItemArray;
AccessDT.Rows.Add(newrow);
}
Finally call update on the AccessDT and Bingo your done
Hope this helps.
A craft is an enemy if not well learned.
|
|
|
|
|
This method adds unnecessary overhead to the process. It is more efficient to use a DataReader to access the Excel data and run direct INSERT statements against the Access database.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I have a group of shapes in a WPF UserControl, and I want them to all have the same color selected by the user at runtime. I thought I could create a DynamicResource in place of a hard coded fill value and change the value through the code behind class. This would let me create a property box with a color picker and allow the user to change colors. I cannot get this to work. Below are a couple examples of what I have tried.
Usercontrol XAML file:
<code>
<UserControl x:Class="WpfCustomControlLibrary2.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<UserControl.Resources>
<SolidColorBrush x:Key="SolidBrush" Color="Red"/>
</UserControl.Resources>
<Grid>
<Ellipse Height="27" HorizontalAlignment="Left" Margin="50,42,0,0" Name="ellipse1" Stroke="Black" Fill="{DynamicResource SolidBrush}" VerticalAlignment="Top" Width="46" />
<Ellipse Height="27" HorizontalAlignment="Left" Margin="10,10,0,0" Name="ellipse2" Stroke="Black" Fill="#FF0000FF" VerticalAlignment="Top" Width="46" />
</Grid>
</UserControl>
</code>
Code behind class for the control.
<code>
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
static UserControl1()
{
FillColorProperty = DependencyProperty.Register("SolidBrush", typeof(SolidColorBrush),
typeof(UserControl1), new UIPropertyMetadata(Brushes.PowderBlue));
}
static DependencyProperty FillColorProperty;
/// <summary>
/// PLACEHOLDER
/// </summary>
public SolidColorBrush SolidBrush
{
get
{
return (SolidColorBrush)base.GetValue(FillColorProperty);
}
set
{
base.SetValue(FillColorProperty, value);
}
}
}
</code>
I have tried so many ways to do this, that I am grasping at straws now. Any help would be appreciated.
|
|
|
|
|
So you define a Resouce and a dependend property with the same Name - why don't you just stay with the Dependend Property?
(I can't even see where you use the "SolidBrush"-Resource).
Maybe you can post some code where you want to use this Brush because I guess your mistake lies there.
|
|
|
|
|
I guess I am not being to helpful to myself. I just want to create a custom control with two ellipses with a variable fill color that can be changed at runtime.
The control would have a property dialog with a color picker, that would change the ellipse fill color to the selected color. That is all I need.
I know I could set the fill color of each ellipse independently by modifying the Fill property in the codebehind, but I was looking for a way to just change a single "color" variable and save myself some work.
I have been trying every combination of resource, dynamic property, and anything else I can find, and I posted some code somewhere between changes.
Thanks for any help you can give.
Shawn
<UserControl x:Class="WpfCustomControlLibrary2.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<UserControl.Resources>
<SolidColorBrush x:Key="SolidBrush" Color="#FF00FFFF"/>
<UserControl.Resources>
<Grid>
<Ellipse Height="27" HorizontalAlignment="Left" Margin="50,42,0,0" Name="ellipse1" Stroke="Black" Fill="{DynamicResource SolidBrush}" VerticalAlignment="Top" Width="46" />
<Ellipse Height="27" HorizontalAlignment="Left" Margin="10,10,0,0" Name="ellipse2" Stroke="Black" Fill="{DynamicResource SolidBrush}" VerticalAlignment="Top" Width="46" />
</Grid>
<UserControl>
In the control's code behind file:
SolidColorBrush _FillColor;
public SolidColorBrush SolidBrush
{
get
{
return (SolidColorBrush) _FillColor;
}
set
{
_FillColor = value;
}
}
I got an answer from the MSDN Forums
<UserControl x:Class="WpfCustomControlLibrary2.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Height="300" Width="300">
<Grid>
<Ellipse Height="27" HorizontalAlignment="Left" Margin="50,42,0,0" Name="ellipse1" Stroke="Black" Fill="{Binding Path=SolidBrush}" VerticalAlignment="Top" Width="46" />
<Ellipse Height="27" HorizontalAlignment="Left" Margin="10,10,0,0" Name="ellipse2" Stroke="Black" Fill="{Binding Path=SolidBrush}" VerticalAlignment="Top" Width="46" />
</Grid>
<UserControl>
OR
<UserControl x:Class="WpfCustomControlLibrary2.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<Grid>
<Ellipse Height="27" HorizontalAlignment="Left" Margin="50,42,0,0" Name="ellipse1" Stroke="Black" Fill="{Binding Path=SolidBrush, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" VerticalAlignment="Top" Width="46" />
<Ellipse Height="27" HorizontalAlignment="Left" Margin="10,10,0,0" Name="ellipse2" Stroke="Black" Fill="{Binding Path=SolidBrush, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" VerticalAlignment="Top" Width="46" />
</Grid>
<UserControl>
And change the code behind to:
public static readonly DependencyProperty SolidBrushProperty = DependencyProperty.Register("SolidBrush", typeof(SolidColorBrush), typeof(UserControl1), new UIPropertyMetadata(null));
public SolidColorBrush SolidBrush
{
get { return (SolidColorBrush)GetValue(SolidBrushProperty); }
set { SetValue(SolidBrushProperty, value); }
}
Maybe this helps someone else.
modified on Monday, January 14, 2008 7:12:32 PM
|
|
|
|
|
Shawn Horton wrote: <usercontrol x:class="WpfCustomControlLibrary2.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" height="300" width="300"> <grid> <ellipse height="27" horizontalalignment="Left" margin="50,42,0,0" name="ellipse1" stroke="Black" fill="{Binding Path=SolidBrush, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" verticalalignment="Top" width="46"> <ellipse height="27" horizontalalignment="Left" margin="10,10,0,0" name="ellipse2" stroke="Black" fill="{Binding Path=SolidBrush, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" verticalalignment="Top" width="46"> <usercontrol>
And change the code behind to:
public static readonly DependencyProperty SolidBrushProperty = DependencyProperty.Register("SolidBrush", typeof(SolidColorBrush), typeof(UserControl1), new UIPropertyMetadata(null)); public SolidColorBrush SolidBrush { get { return (SolidColorBrush)GetValue(SolidBrushProperty); } set { SetValue(SolidBrushProperty, value); } }
This one should work but maybe you should change the DependencyProperty code to something like
<br />
FrameworkPropertyMetadata metaBrush= new FrameworkPropertyMetadata(<br />
Brushes.Blue, FrameworkPropertyMetadataOptions.None);<br />
SolidBrushProperty = DependencyProperty.Register("SolidBrush",<br />
typeof(SolidColorBrush),<br />
typeof(UserControl1),<br />
metaBrush);<br />
(I normaly define this in the static constructor of the class)
As you can see the only difference is the use of the initialised (Blue brush) FrameworkPropertyMetadata instead of a empty UIPropertyMetadata.
The rest looks fine to me.
|
|
|
|
|
CKnig wrote: FrameworkPropertyMetadata metaBrush= new FrameworkPropertyMetadata(
Brushes.Blue, FrameworkPropertyMetadataOptions.None);
SolidBrushProperty = DependencyProperty.Register("SolidBrush",
typeof(SolidColorBrush),
typeof(UserControl1),
metaBrush);
(I normaly define this in the static constructor of the class)
As you can see the only difference is the use of the initialised (Blue brush) FrameworkPropertyMetadata instead of a empty UIPropertyMetadata.
The rest looks fine to me.
I did that last night, the control works great. Thanks for the help.
Shawn
|
|
|
|
|
hi!
can anyone help me where i will get source code in c#
for developing fingerprint software?
faz
|
|
|
|
|
eLance?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
sorry,what do you mean by eLance?
actually i need to do this fingerprint software for my project
i need a sample of project and my project actually focus on
ridge reconstruction process in fingerprint.
so i hope u can help me or just let me know where
to find the source?
thanks..
faz
|
|
|
|
|
DAtabases>systemdatabases>master>tables>system tables
right click on tables and create new tables give it a goodname
have 4 columns - 'Id' numeric type
'name' varchar
'dept' varchar
select * from dbo.Employees
create proc ListEmployees
as
begin
select * from dbo.Employees
end
alter proc ListEmployees
@eid int
as
begin
select * from dbo.Employees where id = @eid
end
-----using System.Data.SqlClient;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection sqlObj = new SqlConnection();
sqlObj.ConnectionString = "data source=.;database =Employees;Trusted_Connection=yes";
SqlCommand sqlCmdObj = new SqlCommand();
sqlCmdObj.Connection = sqlObj;
//We have a command and connection oject -this data adapter is the interface for the two
SqlDataAdapter sqlAdapterObj = new SqlDataAdapter();
sqlAdapterObj.SelectCommand = sqlCmdObj;
DataSet dSetObj = new DataSet();
sqlCmdObj.CommandText = "ListEmployees";
sqlCmdObj.CommandType = CommandType.StoredProcedure;
sqlAdapterObj.Fill(dSetObj);
GridView1.DataSource = dSetObj.Tables[0];
GridView1.DataBind();
|
|
|
|
|
is this a question or answer to no question?
|
|
|
|
|
Am sorry .it was meant to be an answer but posted in the inocrrect forum.Wss in a hurry.Sorry
|
|
|
|
|
------------
--------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection sqlObj = new SqlConnection();
sqlObj .ConnectionString = System.Configuration.ConfigurationManager.AppSettings["connectionStrings"].ToString();
SqlCommand sqlCmdObj = new SqlCommand();
sqlCmdObj.Connection = sqlObj;
//We have a command and connection object -this data adapter is the interface for the two
SqlDataAdapter sqlAdapterObj = new SqlDataAdapter();
sqlAdapterObj.SelectCommand = sqlCmdObj;
DataSet dSetObj = new DataSet();
sqlCmdObj.CommandText = "selQry";
sqlCmdObj.CommandType = CommandType.StoredProcedure;
sqlAdapterObj.Fill(dSetObj);
GridView1.DataSource = dSetObj.Tables[0];
GridView1.DataBind();
}
protected void btnEnter_Click(object sender, EventArgs e)
{
SqlConnection sqlObj = new SqlConnection();
sqlObj.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["connectionStrings"].ToString();
SqlCommand sqlCmdObj = new SqlCommand();
sqlCmdObj.Connection = sqlObj;
sqlObj.Open();
sqlCmdObj.CommandText = "insQry";
sqlCmdObj.CommandType = CommandType.StoredProcedure;
if (txtName.Text != ""&& txtAddress.Text!="")
{
sqlCmdObj.Parameters.AddWithValue("@txtname", txtName.Text);
sqlCmdObj.Parameters.AddWithValue("@txtAddress", txtAddress.Text);
sqlCmdObj.ExecuteNonQuery();
}
else
return;
}
protected void txtDelete_Click(object sender, EventArgs e)
{
SqlConnection sqlObj = new SqlConnection();
sqlObj.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["connectionStrings"].ToString();
SqlCommand sqlCmdObj = new SqlCommand();
sqlCmdObj.Connection = sqlObj;
sqlObj.Open();
sqlCmdObj.CommandText = "delQry";
sqlCmdObj.CommandType = CommandType.StoredProcedure;
sqlCmdObj.Parameters.AddWithValue("@txtname", txtName.Text);
sqlCmdObj.Parameters.AddWithValue("@txtAddress", txtAddress.Text);
sqlCmdObj.ExecuteNonQuery();
}
protected void txtName_TextChanged(object sender, EventArgs e)
{
}
}
|
|
|
|
|
Hello All:
How can I take the return value of a message box(i.e if I press on cancel button it'll exit) or anything else .....
Thanks a lot
|
|
|
|
|
DialogResult result = MessageBox.Show("Yes or no", MessageBoxButtons.YesNo);
if(result == DialogResult.Yes)
...
else
...
I love the DialogResult class personally. You can use it on custom dialogs (forms with buttons resembling dialog results).
It's a good way to pass data between forms.
|
|
|
|
|
|
The big empty sig is REALLY annoying, BTW
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Maybe he's an artist trying to make a statement?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
The DialogResult type will be returned and it will tell you which buttons were clicked.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
In a uercontrol i have in a c# application, it requires vertical scrollbars. That part works fine..but there is an annoying and limiting part of it that i'd like to fix.
When you scroll...lets say in Internet explorer..when you click on the scrollbar, move up and down, it is always changing the visible area (virtual space) of the webpage.
In my application's user control i click down on the scrollbar, move it up and down, release on the scrollbar and then it updates the visiblearea. Note that the visible area doesn't change at all until you release.
How can i get the feature of constant updateing of a controls visible area?
|
|
|
|