|
:(hi all,
in my window form i m bindng one datagrid with check boxes now i wnat to dele those record which are checked how i can do this in window C#
i m also bind the image of the member into datagirdview(images are in the DB)
how i can perform this
regard
|
|
|
|
|
Hi,
Deleting records:
You can follow the following steps to get the "checked" records deleted.
1) First get the records marked "checked"
2) Use the dataGridView1.Rows.Remove to remove the data from the Grid.
3) Use the SqlCommand to get the records deleted from the database.
Binding Images:
I have bound a image column from the access database with the "datagrid" automatically from wizard. Please note that the type of the column in data table is Ole Object.
Manoj
Never Give up
|
|
|
|
|
hi,
i'm trying to parse C# file and want to change the code..
i have a class with following lines of code, assume
class Test
{
public void method()
{
Foo.Bar = "Demo";
}
}
i want to extract only the property name and its value..
i have a pattern like this.. which extract the value only, but i need the property name too..
<code>
"\\Foo.[^;]*(=\\s*\")(?<val>([^\"]*))";
</code>
plz give me a pattern which extract the both.
regards,
nas
|
|
|
|
|
We are using SQLDbAccess.dll provided by Microsoft. There are two methods are filling the Dataset. Fill method and also ExecuteDataSet. Which one will be better? Thanks
|
|
|
|
|
K.P.Kannan wrote: Fill method and also ExecuteDataSet
If your taking about DataAdapter.Fill then it is better to use the ExecuteDataset method as the SQLDBAccess.dll would look after opening/closing connections
|
|
|
|
|
I've been coding for quite sometime but never with web. I just need someone to help me get started.
I'm trying to automatically push a button on a web page without a manual mouse click(its written in html). Where do I start? Can I even do it with C# or should I use another language. I was trying to use the standard webcontrol but it seems limited. Can anyone help? Thank you very much.
|
|
|
|
|
Hi.
It can be done quite easily with the webbrowser control. If this is what you would like to use I could guide you. Please reply if interested.
|
|
|
|
|
I am very interested. Very very interested. Maybe a small code snippet. Thanks again.
|
|
|
|
|
Ok, here it is.
I hope it's not too late. I was quite busy yesterday afternoon and I didn't have time to check the codeproject forum.
So, a simple example of how to do an automatic search on google:
Place a WebBrowser control on your form.
Use it's navigate method to load the google page:
MyWebBrowser.Navigate("http://www.google.com");
In order to access the controls on the webpage and use them, you need to know what their names are from the html source of the page. If you take a look at google's source you'll see all the controls, and among them these two:
and
The first one is the text box where you type the text to search and the second is the search button.
So, all you need to do is fill the text box and after that simulate clicking the "Google Search" button. Like this:
HtmlElement searchBox = MyWebBrowser.Document.All["q"];
searchBox.InnerText = "code project";
HtmlElement btnSearch = MyWebBrowser.Document.All["btnG"];
btnSearch.InvokeMember("click");
Hope this helps.
Have a nice day!
PS: There's a very quick and easy way to find the name of the controls you need from a web page. It's called Firebug. It's a plug-in for Firefox. Just use it. I'm sure you'll find it great, too.
|
|
|
|
|
Everything you said worked to perfection. Thanks for the help. Now that I have the basics down I am able to understand how the control works. You the man!
|
|
|
|
|
I'm glad I could help.
Good luck and happy coding!
|
|
|
|
|
So how would you go about selecting certain boxes. Like username and password, and then click a button.
Login | Username: | | Password: | |
|
|
|
|
|
Well, I guess the same way I filled the search box on google's page.
Have you tried setting the InnerText property?
Maybe you could give me the link to the page you want to interact with and I'll try myself.
|
|
|
|
|
Alright I finnally got everything working except the button. To my knowledge i don't see the button in the source code. It just says
Did you get my email?
-- modified at 2:20 Tuesday 29th May, 2007
|
|
|
|
|
I didn't check my email yesterday. I'll read it in the afternoon(about 4-5 hours from now), as I'm not allowed to use my private email at work.
Did you use Firebug to identify the web controls? If not, please do so. You'll see why.
|
|
|
|
|
Well I actually took a look at another guys source and it pulls up the web page in the program itself. So I just had to modify it. The only problem is there is no button (in the web site) after you input the username and password. The site uses the php post method. Like www.site.net/login.php?user=Myusername&password=mypassword. But they have mypassword encrypted. So right now i'm trying to find away to either have the web browser click the button (but not seeing one in the source code) I think I will have to go with a way to manually click it.
|
|
|
|
|
Hi,
Is there a way to programatically determine if Office11 or which version of it is installed in the local machine? TIA.
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
Project: I'm tring to use iTextSharp assembly to create and print a pdf file in a web application.
Input: pre created template pdf file; dynamic data entry from web page.
Output: print out pdf file with data entry; save pdf with data entry as image to database.
Step 1.Generate pdf file based on pre-created pdf template file and data entered through web page.
Step 2.Print out the pdf file generated from step1.
Problem:
I'm able to persute step 1 using fdf.
What is the best way and how to print out the pdf file created from step1 in web application?
What is the best way to store the pdf file into SQL server database?
Your input is well appreciated.
|
|
|
|
|
I had to do a similar thing, but in a desktop application. In order to print the file I start Adobe Reader with command line parameters, which tell it to print the file.
With you web application, a problem may arise when trying to launch Acrobat Reader using the Process.Start() method. I'm not sure if you're allowed to do that.
|
|
|
|
|
First, thank you for the reply, I did use Process.Start, it works ok, but I try to not using COM, but using .net technic. Any other way?
Thanks,
|
|
|
|
|
This is a new question, after I created a PDF file with data entry using iTextSharp, what is the best way to save it in the situation I need to bring back this PDf file.
Thanks in advance.
|
|
|
|
|
Dear Friends:
How can a program set the caret position in the text of the editable ComboBox? I set the ComboBox.SelectionStart and then ComboBox.SelectionLength. The caret for insertion automatically moved to the end of the selection, i.e. at the position, SelectionStart + SelectionLength. I want to move the caret to the beginning of the selection, i.e. at the position, SelectionStart. I could not find a property or method which can set the position of the caret. Thanks!
|
|
|
|
|
So I've decided to start diving into minor game programming and getting a better understanding of how it's done by making a few games this summer. The first is this clone of the Zombie Simulator that you might of seen by Kevan Davis. I'm not trying to be original mind you just to learn. I figured i'd be a pretty easy start but I've come to a dead stop.
I've managed to randomly create "buildings" but I'm having issues with my "Being" class being able to manipulate the outsider world. In the main program class "Zombie" I have my bitmap image set to protected which SHOULD allow for the Being class to manipulate it since it is a derived class from Zombie. So maybe someone can help me. What the hell am I doing wrong? BTW I know not all the methods are completely...but I must first be able to display the object before I continue onward. Below is all the code I've done. I hope it isn't to long.
using System; <br />
using System.Drawing; <br />
using System.Drawing.Drawing2D; <br />
using System.Collections; <br />
using System.ComponentModel; <br />
using System.Windows.Forms; <br />
using System.Data; <br />
<br />
namespace ZombiesSim<br />
{<br />
public class Zombie : System.Windows.Forms.Form <br />
{<br />
private System.ComponentModel.IContainer components;<br />
<br />
private bool _doBuffer = true;<br />
private int freeze, x, y, bwidth, bheight;<br />
private Color human, panichuman, zombie, wall;<br />
private int num = 1000;<br />
private int speed = 1;<br />
private Graphics g;<br />
private bool gxstart;<br />
private Being bee;<br />
public Bitmap world;<br />
protected int width, height;<br />
private Random rand = new Random();<br />
<br />
<br />
public Zombie() <br />
{ <br />
InitializeComponent(); <br />
<br />
human = Color.Purple;<br />
panichuman = Color.Pink;<br />
zombie = Color.Lime;<br />
wall = Color.DimGray;<br />
<br />
width = this.ClientSize.Width;<br />
height = this.ClientSize.Height;<br />
<br />
world = new Bitmap( width, height );<br />
g = Graphics.FromImage( world );<br />
gxstart = true;<br />
<br />
freeze = 0;<br />
}<br />
<br />
protected override void Dispose( bool disposing ) <br />
{ <br />
if( disposing ) <br />
{ <br />
if (components != null) <br />
{ <br />
components.Dispose(); <br />
} <br />
} <br />
base.Dispose( disposing ); <br />
} <br />
<br />
#region Windows Form Designer generated code <br />
private void InitializeComponent() <br />
{ <br />
this.components = new System.ComponentModel.Container(); <br />
this.SuspendLayout(); <br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); <br />
this.ClientSize = new System.Drawing.Size(666, 666); <br />
this.Name = "Zombie Simulation"; <br />
this.Text = "Zombie Simulation"; <br />
this.ResumeLayout(false);<br />
this.MaximizeBox = false;<br />
this.FormBorderStyle = FormBorderStyle.FixedDialog;<br />
this.Shown += new System.EventHandler(this.Zombie_Shown);<br />
}<br />
#endregion<br />
<br />
[STAThread]<br />
static void Main()<br />
{<br />
Application.Run(new Zombie());<br />
}<br />
<br />
private void Zombie_Shown(object sender, EventArgs e)<br />
{<br />
}<br />
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
if( world != null && gxstart == true )<br />
{<br />
<br />
g.Clear(Color.Black);<br />
<br />
for( int i = 0; i < 100; i++)<br />
{<br />
x = rand.Next( this.ClientSize.Width );<br />
y = rand.Next( this.ClientSize.Height );<br />
bwidth = rand.Next( 30, 90 );<br />
bheight = rand.Next( 30, 90 );<br />
g.FillRectangle( new SolidBrush( wall ), x, y, bwidth, bheight );<br />
}<br />
<br />
for( int i = 0; i < 30; i++)<br />
{<br />
x = rand.Next( this.ClientSize.Width );<br />
y = rand.Next( this.ClientSize.Height );<br />
bwidth = rand.Next( 40, 60 );<br />
bheight = rand.Next( 40, 60 );<br />
g.FillRectangle( new SolidBrush( wall ), x, y, bwidth, bheight );<br />
}<br />
<br />
gxstart = false;<br />
<br />
}<br />
<br />
setup();<br />
<br />
if(_doBuffer)<br />
{<br />
e.Graphics.DrawImageUnscaled( world ,0,0);<br />
}<br />
}<br />
<br />
public void setup()<br />
{<br />
bee = new Being();<br />
<br />
}<br />
<br />
protected override void OnPaintBackground(PaintEventArgs pevent) <br />
{ <br />
} <br />
<br />
protected override void OnSizeChanged(EventArgs e)<br />
{<br />
<br />
}<br />
}<br />
<br />
public class Being : Zombie<br />
{<br />
private int xpos, ypos, dir;<br />
private int type;<br />
private int active;<br />
private Random rand = new Random();<br />
private Color hue;<br />
<br />
public Being()<br />
{<br />
dir = rand.Next( 1, 4 );<br />
type = 1;<br />
active = 0;<br />
hue = Color.Purple;<br />
position();<br />
world.SetPixel( 5, 5, Color.Purple );<br />
}<br />
<br />
public int[] getposition()<br />
{<br />
int[] pos = { xpos, ypos };<br />
return pos;<br />
}<br />
<br />
public void position()<br />
{<br />
for( int j = 0; j < 100; j++ )<br />
{<br />
xpos = rand.Next( 1, width - 1);<br />
ypos = rand.Next( 1, height - 1);<br />
if( world.GetPixel( xpos, ypos ) == Color.Black )<br />
j = 100;<br />
}<br />
}<br />
<br />
<br />
<br />
public void infect( int x, int y )<br />
{<br />
if( x == xpos && y == ypos )<br />
type = 2;<br />
}<br />
<br />
public void infect()<br />
{<br />
hue = Color.Lime;<br />
type = 2;<br />
}<br />
<br />
public void uninfect()<br />
{<br />
hue = Color.Purple;<br />
type = 1;<br />
}<br />
<br />
public void look( int x, int y )<br />
{<br />
dir = rand.Next( 1, 4 );<br />
<br />
if( dir == 1 )<br />
y++;<br />
if( dir == 2 )<br />
x++;<br />
if( dir == 3 )<br />
y--;<br />
if( dir == 4 )<br />
x--;<br />
}<br />
<br />
public void move()<br />
{<br />
<br />
}<br />
}<br />
}
|
|
|
|
|
What do you percieve to be wrong ? If it doesn't compile, what line is the problem and what's the error ? If it does, then what is failing to happen, and what code is not doing what you'd hoped ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It compiles but it is something with the "Being" class not being able to manipulate the "world" variable even though the permissions is set correctly. so I have no clue and since this is my first time manipulating graphics I'm not even sure if I'm initializing an instance of Being correctly.
|
|
|
|