|
Hi Minh. Thanks for the input. Unfortunately, that didn't work, and I can't use the ControlIDConverter class, because it's a new addition to .NET 2.0, and I'm trying to write my control to support 1.1 and up. I'll keep digging, though.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
|
Hi leppie. Name didn't seem to show up in my Intellisense, so it's either not available, or Intellisense isn't picking it up. I'll play around some more with it at lunch. Thanks for the input, though.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
Fixed it. I had to make the following change:
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string) && value is Control)
return (value as Control).ID;
return base.ConvertTo (context, culture, value, destinationType);
}
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
Hi.
I have a gridview (GridView1) with a SQL database as datasource.
the datasource has no data, so the gridview contains no data.
my problem is that in the gridviews footer, there is a textbox and a button to insert data to the database. but they are not shown because the gridview is not shown.
So how do i display the gridview even when it contains no data ?
|
|
|
|
|
Hi,, i'm workin for 15 hours till now on that tiny piece of code, and i just can't get it right...
in my application i have DAL a class with all the Database functions..
my problem is when i want to update the sql server with a dataset..
when ever i use the automated SQLDATAADAPTER wizard , it's ok..
but i want it to be through the code..
I know that if i want to use the DataAdapter.Update(Dataset) i need to implement the UpdateCommand,DeleteCommand ,SelectCommand and insertCommand.
And i also know the SqlCommandBuilder can generate those sqlcommands automatically.
but when i try doin
SQLDataAdapter.UpdateCommand = SqlCommandBuilder.GetUpdateCommand();
i get the followin error.
ExecuteReader: CommandText property has not been initialized
Please Help .. i'm STUCK!
i'm postin my DAL as well...
Thanks!
public class DAL
{
private SqlConnection conn;
private SqlDataAdapter adapter;
private SqlCommand selCommand = new SqlCommand();
private SqlCommandBuilder builder;
public DAL()
{
conn = new SqlConnection("Server="+AppSettings.AppSets.ServerAddress+";Database=MaftehDb;Integrated Security=SSPI");
adapter = new SqlDataAdapter();
builder = new SqlCommandBuilder(adapter);
selCommand.Connection = conn;
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
adapter.SelectCommand = new SqlCommand();
adapter.SelectCommand.Connection = conn;
adapter.UpdateCommand = new SqlCommand();
adapter.UpdateCommand.Connection = conn;
builder.RefreshSchema();
adapter.UpdateCommand = builder.GetUpdateCommand();
adapter.InsertCommand=new SqlCommand();
adapter.InsertCommand.Connection=conn;
adapter.DeleteCommand = new SqlCommand();
adapter.DeleteCommand.Connection = conn;
}
}
|
|
|
|
|
Hii,
Here the piece of code all you need.
You must the same DataSet and DataAdapter for the update operation.
private void UpdateData()
{
if (myDataSet.HasChanges())
{
adapter.Update(ds.Tables[0]);
myDataSet.AcceptChanges();
}
}
private void LoadData()
{
conn = new OleDbConnection(ConnectionString);
conn.Open();
selCommand = new OleDbCommand("SELECT * FROM EMP",conn);
adapter = new OleDbDataAdapter(selCommand);
builder = new OleDbCommandBuilder(adapter);
myDataSet = new DataSet();
adapter.Fill(myDataSet);
dataGrid1.DataSource = myDataSet.Tables[0];
}
You can pass the OleDbDataAdapter,DataSet to your DAL method.
Regards,
Gokulan
|
|
|
|
|
Thankd! i was going out of my mind...
the thing the tackeld me was when i did the Update , i gave him only the Dataset where you wrote me to give him the dataset.table[0] , it solved my prob!
AnyWAy ! THANKS!
|
|
|
|
|
Hi,
Does anyone know how to hide and show the windows taskbar by using C#?
I know how to do it in C++, But I have no idea how to do it in C#.
Please help me!!!
Thank a lot in advance!!
Alan
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
Just like in C++, you find the TaskBar window by its name using the FindWindow P/Invoke and send the window a message through the ShowWindow P/Invoke.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
In VS 2003 there were toolbar buttons for toggling case-sensitive and whole word searches. I often used these in situations where I'd done a keyboard search and then decided I needed to toggle to case-sensitive or whole word. It was easy to use the buttons to do this.
However, these buttons, and the underlying commands, seem to be absent from VS 2005. Anyone know how to do them without having to bring up the Find/Replace dialog?
Kevin
|
|
|
|
|
|
Hi,
I want to create an application with a small backend Database, currently i decide to use an Access DB for now, but what should be the proper way to implement the connection?
I have tried to add an existing access file into the Project, Visual Studio automatically create a DataSet.xsd file for me, what is the use of that file?
Thanks Alot
Hope to find the Answer
From a beginner
|
|
|
|
|
when you are using MS Access Db, Better to use OLEDB Connection. connection string as follows
http://www.sqlstrings.com/MS-Access-connection-strings.htm[^]
DataSet.xsd file is auto generated xml file, will exists client side, .NET Disconnected architecture will follows this xml file.
regards
GV Ramana
|
|
|
|
|
hi to all,
i need to iterate through the documents that are open with winword.
for exp :
suppose we have 5 documents opened with winword. I need to loop through theese 5 documents to see if one of them match the one i search. And if yes, i want to close it (close the document and not winword)
best regards and thanks in advance
fady
|
|
|
|
|
Hi,
Hope this piece of code will help you.
//Add the Microsoft Word 11.0 Object Library Reference
using System.Runtime.InteropServices;
using Microsoft.Office.Interop.Word;
//Fields
private object objSave = false;
private object objOrgFormat;
private object objRouteDoc;
private void IterateWordDocs()
{
//Get the active Word Application
GetWordApplication()
//Iterate docs
foreach (Microsoft.Office.Interop.Word.Document doc in WordApp.Documents)
{
if(doc.Name == "YourDocName")
doc.Close(ref objSave,ref objOrgFormat,ref objRouteDoc);
}
}
public void GetWordApplication()
{
Type typeVisioApp = Type.GetTypeFromProgID("Word.Application");
object objWord = Marshal.GetActiveObject("Word.Application");
this.WordApp = (Microsoft.Office.Interop.Word.Application) Marshal.CreateWrapperOfType (objWord, typeVisioApp);
}
Regards
Gokulan
-- modified at 2:03 Wednesday 28th December, 2005
|
|
|
|
|
I was seeing the UI of Virtools Dev(www.virtools.com). I was wondering how they did it. How did they built it? They used photoshop to make the various components and then import them in Visual Studio? How can you make a custom UI with WinForms but use your own graphics and of course attach functionallity to them?
|
|
|
|
|
Hi,
Nowadays many number of third party image, Photo ediiting softwares are available. Phontoshop is only is for image Editing only. Right?.
many web sites will use flash Script, animation tools etc.
regards
GV Ramana
|
|
|
|
|
Hello can anyone help me with this peculiar problem.
How can i read f.ex text from a textbox belonging to another form(object)
|
|
|
|
|
This article[^] details the techniques that for which you will likely be looking.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
hi,
you can create a propety and set the property to the textbox's text value when the text is entered and then you can access the data from that property
hope u get it
Regards,
Pramod
|
|
|
|
|
Hope this helps. I think this is the least confusing method. This is the class of the main form that calls the child form:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace PassingDataBetweenForms2
{
public partial class Form1 : Form
{
//Declare an object of Form2 class - the form to be
//called from this form (Form1)
public Form2 ChildForm;
public Form1()
{
InitializeComponent();
}
private void Form1_DoubleClick(object sender, EventArgs e)
{
//Initialize the Form2 class object
ChildForm = new Form2();
//Assign the main form (parent form - of class Form1)
//to the object of class Form1 that is defined in class Form2
//This is the part which creates the link between the two forms
ChildForm.ParentFormObject = this;
//Open/Show the child dialog of class Form2
ChildForm.Show();
}
private void textBox1_Click(object sender, EventArgs e)
{
//When you click in the text box in parent form (Form1 class)
//this assigns a value to a label on the child form (Form2 class)
ChildForm.label1.Text = "This came from the parent form (Form1)";
}
}
}
//*******************************************
//This is the class of the child form
//*******************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace PassingDataBetweenForms2
{
public partial class Form2 : Form
{
//Declare an object of the parent form class (Form1)
//Make sure the controls which neet to be assecced from
//the parent form are public, internal,
//or internal protected otherwise you won't be able to
//access them.
public Form1 ParentFormObject;//Same goes for the Form1, Form2 objects
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//This function is executed when the button on
//this form - child form (of class Form2) is pressed.
//This action assigns a value to the textbox of the parent form (Form1 class)
//from this form - child form (Form2 class)
ParentFormObject.textBox1.Text = "Text sent from ChildForm (Form2)";
}
}
}
-- modified at 12:38 Tuesday 27th December, 2005
|
|
|
|
|
is there a way to deploy a windows service app.. so tht its becomes a sevices at the start up
sathy
|
|
|
|
|
go to
Design view of your Service.cs file, right click add Installer, you will get ServiceInstaller, ServiceProcessInstaller. Select ServiceInstaller, go to properties set StartType to Automatic.
Make a setup project and deploy.
regards
GV Ramana
|
|
|
|
|
thanks GV, but this is how i made the setup but this is installing and i can c my service at the windows service list but i cant start it ... its showing a "JIT error "
sathy
|
|
|
|