|
mohammad alnoed wrote: how i can create query wizard to database
What does it mean ? You want to create a similiar application like query wizerd ?
or you want know how to used it?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
yes I am working to create application I know how create connection by wizard but I don't know how create query wizard to database to get one vlaue
note
in the database three colume
id
name
level
on form I use datagridview have same columen likes database .
I need if I was inserting number 1 in colume id in datagridview other column get data from database
after this explean I just want to know how create query wizare to get on value like
select name from student where id=1;
|
|
|
|
|
mohammad alnoed wrote: yes I am working to create application I know how create connection by wizard but I don't know how create query wizard to database to get one vlaue
I am really confused with your question. What do you mean by that ? You want to show data in your datagrid?
Please state your problem clearly.
You have asked the same question over Here , and think you are not able to express what you wants .
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hello,
Do you guys know any open source C# implementation of XAML Object Mapping Specification? If yes, please share me some links.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Hi Michael,
Personally I do not know !
But, we have a "grandmaster" of XAML here on CodeProject, Marc Clifton, and I suggest you take a look at his many articles :
http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=36803[^]
And then there is Josh Smith, and Sacha Barber, WPF Gurus, they also have written on XAML, I believe.
best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
|
|
|
|
|
Thanks, Bill.
I emailed to Marc (Marc Clifton) regarding his MyXaml implementation last night and got his reply saying that this specification wasn't out yet when he was implementating MyXaml and he doesn't have any implementation for that specification as well..
but yes. I will broadcast the mail in WPF-Discipline group since Josh, Sacha and others are in that group..
Thanks, man.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
I'm trying to make a column of a datagridview to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have:
1) Initially all the cells of the dtp column should be blank unless they are filled by the user.
2) As soon as the user enters a cell, the dtp control should appear as the editing control of that cell. If there's a value in the cell beforehand, that value is set as the value of the dtp editing control and it is checked, else the dtp editing control remains unchecked.
3) If the user selects a date from the dtp editing control and moves to another cell the value of the dtp should be set to the previous cell in string format (In that way we can define custom format for the cell e.g. dd MMM yyyy).
4) If the user unchecks the dtp editing control while it's on a cell the value of that cell should be set to null irrespective of whether the cell had a value beforehand.
I managed everything till point 3. But can't work out with point 4. Cannot set the value of a cell to null when its dtp editing control is unchecked. There's a way to do it by handling the Datagridview_CellValidating event. But in that case if the datagridview is data bound, u need to uncheck the editing control once, goto another cell, come back to the previous one and uncheck it once again to set its cell value to null. I want to know if there's any way to do it through the derived classes or their class template that I'm using so that I wont have to use that event and everything can be done through the class template only. Please help. My code follows:
Code for the template (I'm using a code file) containing all the derived classes:
using System;
using System.Windows.Forms;
namespace DGV_DateTimePicker
{
public class DateTimePickerColumn : DataGridViewColumn
{
public DateTimePickerColumn()
: base(new DateTimePickerCell())
{
}
public override DataGridViewCell CellTemplate
{
get
{
return base.CellTemplate;
}
set
{
if (value != null &&
!value.GetType().IsAssignableFrom(typeof(DateTimePickerCell)))
{
throw new InvalidCastException("Must be a DateTimePickerCell");
}
base.CellTemplate = value;
}
}
}
public class DateTimePickerCell : DataGridViewTextBoxCell
{
public DateTimePickerCell()
: base()
{
this.Style.Format = "dd MMM yyyy";
}
public override void InitializeEditingControl(int rowIndex, object
initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
{
base.InitializeEditingControl(rowIndex, initialFormattedValue,
dataGridViewCellStyle);
DateTimePickerEditingControl ctl = (DateTimePickerEditingControl)DataGridView.EditingControl;
DateTime d;
ctl.Value = DateTime.TryParse((Value ?? "").ToString(), out d) ? d : DateTime.Now;
if (ctl.EditingControlDataGridView.CurrentCell.OwningColumn.IsDataBound)
ctl.Checked = Value.ToString() == "" ? false : Value == null ? false : true;
else
ctl.Checked = Value == null ? false : true;
}
public override Type EditType
{
get
{
return typeof(DateTimePickerEditingControl);
}
}
public override Type ValueType
{
get
{
return typeof(DateTime);
}
}
public override object DefaultNewRowValue
{
get
{
return null;
}
}
}
class DateTimePickerEditingControl : DateTimePicker, IDataGridViewEditingControl
{
DataGridView dataGridView;
private bool valueChanged = false;
int rowIndex;
public DateTimePickerEditingControl()
{
this.Format = DateTimePickerFormat.Custom;
this.CustomFormat = "dd MMM yyyy";
this.ShowCheckBox = true;
this.Checked = false;
}
public object EditingControlFormattedValue
{
get
{
return this.Value.ToShortDateString();
}
set
{
if (value is String)
{
this.Value = DateTime.Parse((String)value);
}
}
}
public object GetEditingControlFormattedValue(
DataGridViewDataErrorContexts context)
{
return EditingControlFormattedValue;
}
public void ApplyCellStyleToEditingControl(
DataGridViewCellStyle dataGridViewCellStyle)
{
this.Font = dataGridViewCellStyle.Font;
this.CalendarForeColor = dataGridViewCellStyle.ForeColor;
this.CalendarMonthBackground = dataGridViewCellStyle.BackColor;
}
public int EditingControlRowIndex
{
get
{
return rowIndex;
}
set
{
rowIndex = value;
}
}
public bool EditingControlWantsInputKey(
Keys key, bool dataGridViewWantsInputKey)
{
switch (key & Keys.KeyCode)
{
case Keys.Left:
case Keys.Up:
case Keys.Down:
case Keys.Right:
case Keys.Home:
case Keys.End:
case Keys.PageDown:
case Keys.PageUp:
return true;
default:
return !dataGridViewWantsInputKey;
}
}
public void PrepareEditingControlForEdit(bool selectAll)
{
}
public bool RepositionEditingControlOnValueChange
{
get
{
return false;
}
}
public DataGridView EditingControlDataGridView
{
get
{
return dataGridView;
}
set
{
dataGridView = value;
}
}
public bool EditingControlValueChanged
{
get
{
return valueChanged;
}
set
{
valueChanged = value;
}
}
public Cursor EditingPanelCursor
{
get
{
return base.Cursor;
}
}
protected override void OnValueChanged(EventArgs eventargs)
{
valueChanged = true;
this.EditingControlDataGridView.NotifyCurrentCellDirty(true);
base.OnValueChanged(eventargs);
}
}
}
Code for the form containing the datagridview:
private void Form1_Load(object sender, EventArgs e)
{
DateTimePickerColumn col = new DateTimePickerColumn();
dataGridView1.Columns.Add(col);
dataGridView1.RowCount = 5;
}
Reference from MSDN 2005- How to: Host Controls in Windows Forms DataGridView Cells
|
|
|
|
|
|
If u check my post, at the footer I have already mentioned about the link u referred. I took reference from that topic but still it doesn't fulfill certain requirements that I mentioned in my points.
|
|
|
|
|
Hi
I have a webBrowser control in my Windows form and I show a logo in that webBrowser (don't ask why ). When a the logo inside webBrowser he can drag it into anywhere. But I want this webBrowser to function just like a picturebox. How can I make the webBrowser to seem like functioning just like a picturebox?
Thanks.
|
|
|
|
|
Not sure how you could do that, but perhaps instead you could download the image from the website and then just load that into an actual picture box
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I know you're saying "don't ask why", but this post begs the question "Why?" What additional functionality are you getting by doing it this way instead of using a pictureBox? I'm just curious.
|
|
|
|
|
Because I may need to run flash files there in future.
|
|
|
|
|
Well, you can always structure the HTML displayed in the webBrowser so that it doesn't link to anything.
You could also try setting the Enabled property to False .
|
|
|
|
|
WebBrowser control doesn't contain an Enabled property.
|
|
|
|
|
|
Well if you were using flash then maybe you would want user interaction? If so then the simple answer would be use a picture box now and a webcontrol when you need it.
Another suggestion, not tested, but you could try create a transparent panel that covers the webcontrol hopefully capturing any user interaction attempted.
Just like a piece of glass that stops passers by helping themselves to the pie that you left cooling on the side by the window.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I've tried that panel idea and it doesn't get transparent because I have more than one layers so Windows can't process it.
|
|
|
|
|
SimpleData wrote: How can I make the webBrowser to seem like functioning just like a picturebox?
Then why not using Picturebox itself. Either download the Image from web site of set it to Picture Box. Or You can directly set the Picture box ImageLocation of that particular image.
Like
pictureBox1.ImageLocation = "http://www.codeproject.com/SiteRes/CP/Img/Std/logo225x90.gif";
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I know it isn't the answer, but this snippet was great. I've used my own code to get an image and put it in a PictureBox for years, never noticing this property. Thanks
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
So you need help for turning a mediocre Control (WebBrowser) into a really bad one (PictureBox)?
I think I'll pass unless you manage to provide a reasonable explanation.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I am not actually trying to turn a webbrowser into a picturebox. I am just trying to make it feel like less webbrowser-ish
|
|
|
|
|
I'm guessing that there's more in the webbrowser then 'just' a logo. Text with markup, perhaps?
Maybe you could use the Control.DrawToBitmap function, to paint the contents of the webbrowser into a bitmap? You could then show the generated bitmap in a PictureBox [^].
|
|
|
|
|
Yes there might be more than just a logo in the webBrowser control, like text or flash animations.
For everything except the flash animation DrawToBitmap is a great solution. But not completely suitable for me.
Thank you all for your answers by the way.
|
|
|
|
|
Last option[^] that I'm aware of would be to override WndProc and eat all messages regarding the mouse
|
|
|
|