|
thank so much !
Could you send the app to me via email : shirleylstam@yahoo.com.hk ?
|
|
|
|
|
|
Apart from that MyAjax .NET thing, MS have a tool called Atlas in development.
Kevin
|
|
|
|
|
I have started working with C# and am trying to do something that I have done in C++, MFC, VB and ASP code. All I want is a read only recordset set that is only a snapshot of several values spanning more that 2 tables with inner joins. I used to do this with a SQL query and recordsets, then step through the recordset till I reached EOF then stop. The new adoAdoAdapter and sqlDataAdapter both error on more then 2 tables linked, and I can't seem to find out the proper information on how to import or use ADO 1.5. I am currently using and Access database, but could move to an SQL if it would help. The problem is that this is a view screen (ListView) and I want to control how the data is entered. I have lookup values linked to other tables. I want the lookup value and not the lookup key.
Thanks,
Leo T. Smith
|
|
|
|
|
Hi,
Currently there is a MS Access Database, how can i do a check and see what tables are contain within the database? OR how can i create a Dataset filled will all tables from the database?(a small database)
Thanks alot
Need help
Thanks so much
|
|
|
|
|
Assuming conn is an open oledb connection to your access database:
DataTable tables = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
new object[] {null, null, null, null});
string[] tableNames = new string[tables.Rows.Count];
for(int i = 0; i < tables.Rows.Count; i++) {
string temp = tables.Rows[i][TABLE_NAME_COLUMN].ToString();
if(tables.Rows[i]["TABLE_TYPE"].ToString() == "TABLE") {
tableNames[i] = temp;
}
}
|
|
|
|
|
Hi!
I`m using winmm.dll to play multimedia files in my c# app! But, when i click on the button to play, i have one small flickering, like the first frame of the avi is black (i think it is a time needed to load the file into RAM)! Multimedia files are large (10-20Mb)! Is there any chance to make preloading of the avi file into RAM, on the form_load event, so, when the user click on the button to play, the file is already in the memory! !? Or, does anybody know how to make that flickering go away!Thanx
-- modified at 20:50 Tuesday 27th December, 2005
|
|
|
|
|
I tried getting the location from using Start Position via Centre Screen.
But the results give me 0,0 for its location. How do I find its position?
-- modified at 20:18 Tuesday 27th December, 2005
UPDATE: Ok, if i use centre screen, I cannot set its location differently unless I use manual, thus is there a way to find the StartPosition location somehow?
|
|
|
|
|
There you go:
//"this" refers to the current form object
Point somePoint = this.PointToScreen(Location);
//Note it calculates it from upper-left edge
of the client area, not the border. I don't think there is a specific function to do that, but you can easily calculate it if you want the location of the form from the border. This is the width and height of the border in pixels: {X=3,Y=29}. Of course if you have tool border (smaller) it will be different. If you want to check that set the form start position to manual like so:
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
This will make your form/dialog box open in the upper-left edge of your screen.
______________________________
|_____________________________|<- form/dialog box border
||...........................................||
||...........................................||<- form border
||.......................<-------------||--- client area
||...........................................||
||...........................................||
||___________________________||
-- Don't worry about the world coming to an end today. It's already tomorrow in Australia --
-- modified at 22:34 Tuesday 27th December, 2005
|
|
|
|
|
Hi.
I have a gridview with a commandfield (edit and delete buttons) i have converted it to a templatefield.
in my C# backend i would like to get those linkbuttons so that i can deactivate them based on events.
i know how to do it if the control is in a footer.
for example:
TextBox txtName = GridView1.FooterRow.FindControl("txtName") as TextBox;
and then i can use it as a normal textbox in my code.
but how do i do it when it's not located in the footer of the gridview ?
|
|
|
|
|
My app loads an image using Image.FromFile() and after some processing the image is saved in another file and the Image object is disposed. But when I need to delete original file, an exception box appears. The problem is that my app (process) is still using original image file.
How to "unmark" the original file from "used" state back to normal "free to write/delete" state?
|
|
|
|
|
Is your app process still running after you close/exit your app? If so, that's strange and means it was not disposed. If not, then it's most likely because your Visual Studio is open and is using it. Try running your app, with Visual Studio not running and see if that was the problem.
|
|
|
|
|
The process that is keeping the file open is yours. When you use FromFile to load an image, that file is kept open for the lifetime of the Image object (don't ask me why!)
The work around is to open the file as a stream, the create the Image from that stream, then close the file.
using(FileStream fs = new FileStream(fileName, FileMode.Open))
{
PictureBox1.Image = Image.FromStream(fs);
}
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks a lot. Now it works fine, damn Image.FromFile()...
|
|
|
|
|
Is it possible to set the Encoding that the WebBrowser control uses? I have a project that pulls content from RSS Feeds and generates HTML output, writes it to file, and then displays it in the webbrowser. However the generated html sometimes renders weird in the Western European Encodings (Windows, ISO). I would like the control to auto-select the encoding the file is created with (in this particular case UTF-8) Is it possible to do so?
Matt Newman
Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots
|
|
|
|
|
Hi, after hours of googling i decided to try my luck here
I'am exploring the world of C# scripting.
Does anybody know how i can export an instance of a object to make
it availble from my script. My plan is to export an object to my scripts
from where i publish some basic functions to interact with the "host program's" GUI.
(I'am new to .NET and C# so mabey i'am aproaching this in the wrong way)
I would really appreciate a tip on this one!
Here is how i run my scripts at the moment:
<br />
public void ExecuteSource(String sourceText) <br />
{<br />
CSharpCodeProvider codeProvider = new CSharpCodeProvider();<br />
<br />
ICodeCompiler compiler = codeProvider.CreateCompiler();<br />
CompilerParameters parameters = new CompilerParameters();<br />
parameters.GenerateExecutable = false;<br />
parameters.GenerateInMemory = true;<br />
parameters.OutputAssembly = "CS-Script-Tmp-Junk";<br />
parameters.MainClass = "CScript.Main";<br />
parameters.IncludeDebugInformation = false;<br />
<br />
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) <br />
{<br />
parameters.ReferencedAssemblies.Add(asm.Location);<br />
}<br />
<br />
CompilerResults results = compiler.CompileAssemblyFromSource(parameters, sourceText);<br />
<br />
if (results.Errors.Count > 0) <br />
{<br />
string errors = "Compilation failed:\n";<br />
foreach (CompilerError err in results.Errors) <br />
{<br />
errors += err.ToString() + "\n";<br />
}<br />
MessageBox.Show(errors, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
} <br />
else <br />
{<br />
object o = results.CompiledAssembly.CreateInstance("CScript");<br />
Type type = o.GetType();<br />
MethodInfo m = type.GetMethod("Main");<br />
<br />
m.Invoke(o,null);<br />
if (File.Exists("CS-Script-Tmp-Junk")) { File.Delete("CS-Script-Tmp-Junk"); }<br />
}<br />
} <br />
|
|
|
|
|
Or mabey i should use VSA scripting for this application instead?
All tip's and hints are more then welcome
|
|
|
|
|
I'm sure I'll kick myself when I see the answer to this, but I'm having a complete brain fart at the moment. I have a custom control that I'm writing for an ASP.NET custom control (it's here because I think the question is generic to both ASP.NET and Windows Forms). What I want is for my property editor to show a drop down with the names of all the controls on my page. I know how to retrieve the ID's of all my controls, I just can't get the TypeConvertor to work properly. Here's my TypeConverter derived class:
<br />
public class RequiredControlListTypeConverter : TypeConverter<br />
{<br />
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)<br />
{<br />
return true;<br />
}<br />
<br />
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)<br />
{<br />
return true;<br />
}<br />
<br />
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)<br />
{<br />
if (destinationType == typeof(string))<br />
return true;<br />
return base.CanConvertTo (context, destinationType);<br />
}<br />
<br />
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)<br />
{<br />
if (destinationType == typeof(string) && value is string)<br />
return Convert.ToString(value);<br />
return base.ConvertTo (context, culture, value, destinationType);<br />
}<br />
<br />
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)<br />
{<br />
if (sourceType == typeof(string))<br />
return true;<br />
return base.CanConvertFrom (context, sourceType);<br />
}<br />
<br />
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)<br />
{<br />
if (value is string)<br />
{<br />
IDesignerHost host = (IDesignerHost)context.GetService(typeof(IDesignerHost));<br />
Page page = (Page)host.RootComponent;<br />
return page.FindControl((string)value);<br />
}<br />
<br />
return base.ConvertFrom(context, culture, value);<br />
}<br />
<br />
<br />
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)<br />
{<br />
IDesignerHost host = (IDesignerHost)context.GetService(typeof(IDesignerHost));<br />
Page page = (Page)host.RootComponent;<br />
StringCollection ctrlIDs = new StringCollection();<br />
FindControls(page.Controls, ctrlIDs);<br />
return new StandardValuesCollection(ctrlIDs);<br />
}<br />
<br />
private void FindControls(ControlCollection ctrls, StringCollection ctrlIDs)<br />
{<br />
foreach(Control ctrl in ctrls)<br />
{<br />
if (ctrl.HasControls())<br />
FindControls(ctrl.Controls, ctrlIDs);<br />
ctrlIDs.Add(ctrl.UniqueID);<br />
}<br />
}<br />
}<br />
This TypeConverter is used on a property whose type is System.Web.UI.Control. The problem I'm having is that when I go to choose a control, I get the controls type (System.Web.UI.WebControls.TextBox, for example), not its ID. Any ideas?
Thanks in advance.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
-- modified at 17:32 Tuesday 27th December, 2005
|
|
|
|
|
Hi Jamie,
Perhaps, the problem is in the ConvertFrom method of your custom type converter. Instead of returning the Id of the control, the method returns the Type of the control from the result of the FindControl method. You may try this when the value is of the string type:
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
return value;
}
return base.ConvertFrom(context, culture, value);
} Also, you can try the two options below:
+ Your custom converter can inherit from the StringConverter , and comment out four methods: CanConvertTo, ConvertTo, CanConvertFrom, ConvertFrom.
+ Use the ControlIDConverter instead of developing a custom converter.
|
|
|
|
|
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;
}
}
|
|
|
|
|