|
Thanks Luc Pattyn.
Freshman
|
|
|
|
|
you're welcome.
|
|
|
|
|
I must using
StackFrame CallStack = new StackFrame(0, true);
Console.Write("File: " + CallStack.GetFileName() + ",
Line: " + CallStack.GetFileLineNumber());
Freshman
|
|
|
|
|
I am trying to update my Access and I am recieving an Error:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace ProspectorV100
{
public partial class frmProspectMaint : Form
{
OleDbConnection cnADONETConnection = new OleDbConnection();
OleDbDataAdapter daContactsCombo;
OleDbCommandBuilder cbContactsCombo;
DataTable dtContactsCombo = new DataTable();
int row;
long intContactID;
public frmProspectMaint()
{
InitializeComponent();
}
private void frmProspectMaint_Load(object sender, EventArgs e)
{
cnADONETConnection.ConnectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Prospector\Database\prospect.mdb";
cnADONETConnection.Open();
daContactsCombo =
new OleDbDataAdapter("Select * From Contacts Order by Last_Name", cnADONETConnection);
OleDbCommandBuilder cbContactsCombo = new OleDbCommandBuilder(daContactsCombo);
daContactsCombo.Fill(dtContactsCombo);
this.LoadSearchBox();
}
private void LoadSearchBox()
{
for (int x = 0; x < dtContactsCombo.Rows.Count; x++)
{
tlsSearch.Items.Add(dtContactsCombo.Rows[x]["Last_Name"].ToString() + ", " +
dtContactsCombo.Rows[x]["First_Name"].ToString());
tlsSearch.AutoCompleteCustomSource.Add(dtContactsCombo.Rows[x]["Last_Name"].ToString() + ", " +
dtContactsCombo.Rows[x]["First_Name"].ToString());
}
}
private void frmProspectMaint_FormClosed(object sender, FormClosedEventArgs e)
{
cnADONETConnection.Close();
cnADONETConnection.Dispose();
}
private void tlsSearch_SelectedIndexChanged(object sender, EventArgs e)
{
row = tlsSearch.SelectedIndex;
intContactID = Convert.ToInt32(dtContactsCombo.Rows[row]["Contact_ID"].ToString());
txtFirstName.Text = dtContactsCombo.Rows[row]["First_Name"].ToString();
txtLastName.Text = dtContactsCombo.Rows[row]["Last_Name"].ToString();
txtCompany.Text = dtContactsCombo.Rows[row]["Company_Name"].ToString();
txtJobTitle.Text = dtContactsCombo.Rows[row]["Job_Title"].ToString();
}
private void tlsSave_Click(object sender, EventArgs e)
{
//If there is existing Data Update it
if (row >= 0)
{
dtContactsCombo.Rows[row]["Contact_ID"] = intContactID;
dtContactsCombo.Rows[row]["Last_Name"] = txtLastName.Text;
dtContactsCombo.Rows[row]["First_Name"] = txtFirstName.Text;
dtContactsCombo.Rows[row]["Company_Name"] = txtCompany.Text;
dtContactsCombo.Rows[row]["Job_Title"] = txtJobTitle.Text;
daContactsCombo.Update(dtContactsCombo);
}
}
}
}
As I stated before I am new to C# and any help would be appreciated.
|
|
|
|
|
kruegersck,
What is the error? and at which line does it happen?
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Sorry - I get an SQL Error at the line: daContactsCombo.Update(dtContactsCombo);
Syntax error in query expression '((Contact_ID = ?) AND ((? = 1 AND First_Name IS NULL) OR (First_Name = ?)) AND ((? = 1 AND Last_Name IS NULL) OR (Last_Name = ?)) AND ((? = 1 AND Company_Name IS NULL) OR (Company_Name = ?)) AND ((? = 1 AND Job_Title IS NULL) OR (Job_Title = ?)) AND ((? ='.
Thanks for all your help
|
|
|
|
|
kruegersck wrote: ((? = 1
I don't think it works like that.
kruegersck wrote: ((? =
Definately this won't work, you have two brackets ( for no good reason ) and they are not closed.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
That is the error message I am getting????
|
|
|
|
|
Yes, so the string you're using for your query, is wrong. That is what I am telling you.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Are there any good examples of doing this using Access?
Thanks Again.
|
|
|
|
|
I'm not sure what you mean by 'doing this', it looks to me like you're asking a SQL question and all you need to do is close your brackets. Where is the issue ?
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Assumption , we have a TreeView in C# form and each node of TreeView contains web address.
Now, I want drag a node into the IE browser as IE opens its web address.
How can we do it ?
Freshman
|
|
|
|
|
I guess the question you need to ask is, what format of drag and drop, if any, does IE support. If it has support for something like this, you need to write code to conforms to what IE expects.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Thank you Christian.
Christian Graus wrote: you need to write code to conforms to what IE expects.
It is my problem exactly
Can you help me ?
Freshman
|
|
|
|
|
A quick google leads me to believe that IE has a drop event handler, so if you had IE in your own window, as a control, you could handle it. I don't see anyting else, but if you try to google it, you may find something.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
OK, Thanks
Freshman
modified on Sunday, June 22, 2008 6:54 PM
|
|
|
|
|
OK, i finally got it. IE expects Files (which we already knew right?). After a little investigation it turns out the a FileDrop is just an array of strings (usualy with just one string in, go figure).
So, simple enough:
void TreeView1ItemDrag(object sender, ItemDragEventArgs e)
{
string[] stuff = new string[1];
stuff[0] = @"http://www.google.co.uk";
.
DataObject data = new DataObject(DataFormats.FileDrop, stuff);
.
this.treeView1.DoDragDrop(data, DragDropEffects.Copy);
}
So, IE will get this info, check the array of strings for the file to open, find your web address, and open it.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Well figured out SK Genius. This could be a useful find
Dave
|
|
|
|
|
Hello,
I am presently creating a list box control for our custom gui application using C# .
The dll is compiled using 1.1 compact framework SDK and is run on windows XP/CE embedded..
The new list box control has to be modified to use custom graphics.. the requirement right now is to replace the windows standard scroll box with the custom images provided..however since we are using compact SDK many of the properties related to the scroll box are not available. Does anyone have an idea a work around .
Regards
Vivian Neil Fernandes
|
|
|
|
|
Don't cross post. It's considered rude and isn't going to help you get an answer any faster. The original message is here[^].
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Hi.
I'm having trouble with a DataGridView. The view displays a list of customers from a query that displays their relevant ID's and names which is bound to a DataTable. When the user double clicks on the customer they want, I would like to get the customer ID of their selection.
I've tried customerDataGrid.SelectedRows(0).Cells(0).Value but I get an error saying that SelectedRows is a property but it is being used as a method.
How do I achieve this. I know it is probably simple but I cannot find the info that I need on MSDN and I am at a loss. Your help is much appreciated in advance.
The FoZ
|
|
|
|
|
TheFoZ wrote: but I get an error saying that SelectedRows is a property but it is being used as a method.
Yeah, because that's what it is.
customerDataGrid.SelectedRows[0].Cells[0].Value
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Looks like I'm still in my VB ways with curved brackets instead of square ones.
Many Thanks
The FoZ
|
|
|
|
|
hey there also you should keep in mind that it is posible to have more than one selected row in a dataGridView unless otherwise set up by you in design time.
if thats desired youll have to do the following...
foreach(DataGridRow myRow in myDataGrid.Rows)
{
}
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Thanks for that. It will come in use later on in the project.
The FoZ
|
|
|
|