|
Vivek_India wrote: sorry if it offended you
In western culture, there is nothing in my post indicating I was offended, because I was not, I am simply offering free advice. You are not obligated to take it.
Vivek_India wrote: so i thought of asking here..its wrong is it...
Not wrong, just not optimal for beginners. Materials have already been design to teach beginners in these subjects and using them would be far more productive than internet forums for learning a subject. The forums are great for specific focused discussions, not so much for large subjects. Multi-threading is a very large subject.
Vivek_India wrote: .i learned all the theory about it
Back when I started I found the chapters in Advanced Windows[^] on multi-threading to be very helpful.
|
|
|
|
|
Hey thanks ...led-mike
And sorry, I completely misunderstood you..
any way i will study the book you recommended( or may be similar text is that ok?)...any way i was wondering what could be wrong and suddenly
the part where a bitmap object is assigned to the image property of the Picturebox
<br />
Picbox.image=screen<br />
was causing the trouble.. when i commented it out, it worked fine..i learned that picturebox was being rendered on a different thread,, than mine so it was accoring to
VS 2005 illegal cross thread operation or something along that line...
is there any thread safe way to do it...
And finally my english is not so good, so i apologize for the inconvenience...
Thnx
and
regards
Vivek
|
|
|
|
|
Vivek_India wrote: is there any thread safe way to do it
Of course, but once again this is the same issue of you trying to write code for a subject that you have not studied. In my experience, software development does not really work out well using that approach. And as I stated before, posting messages on internet forums is no substitution for putting in the proper effort of studying the subjects.
http://www.google.com/search?hl=en&q=MSDN+BeginInvoke&btnG=Google+Search&aq=f&oq=[^]
|
|
|
|
|
How to create icons for windows forms under smart device application in VS 2008?
|
|
|
|
|
Its really so simple . If you have I can maker first make icon you want with 16*16 pixel
go to properties of your project Then in Aplication you will see
Resource there you will get ICON and examin button from there select your icaon what you made before . Thats all
Hope it will help you
|
|
|
|
|
How can I cheange color of BoldedDates in MonthCalendar?
ICQ 33-00-44-7
P.S. Sorry for my English...
|
|
|
|
|
I need to disable some dates in DateTimePicker. User haven't case to select some dates (for example hollidays, special dates, etc.).
How can I do it?
ThnX.
ICQ 33-00-44-7
P.S. Sorry for my English...
|
|
|
|
|
Hi,
You'll have to either check after the user has selected a date, or create your own Control.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I whant to disable click at current day in the Calendar at DateTimePicker...
ICQ 33-00-44-7
P.S. Sorry for my English...
|
|
|
|
|
DateTimePicker does not support that.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
private void dateTimePicker1_Validating(object sender, CancelEventArgs e)
{
if (dateTimePicker1.Value.Date == DateTime.Now.Date)
{
e.Cancel = true;
}
}
This might work.
|
|
|
|
|
In controls that allow selection of a thing, I've seen two common ways to inform the user that the currently selected thing has changed and what the new selected thing is.
In the first method, the event notification arguments contain no extra information about the selected thing but the control has a property for accessing it.
private void someControl_SelectedThingChanged(object sender, EventArgs e)
{
SomeControl someControl = sender as SomeControl;
SomeThing selectedThing = someControl.SelectedThing;
...
}
In the second method, the new selected thing is a property of the event notification arguments.
private void someControl_SelectedThingChanged(object sender, SelectedThingChangedEventArgs e)
{
SomeThing selectedThing = e.SelectedThing;
...
}
One advantage I can see of one method over the other is that the first method is useful if the SomeControl.SelectedThing property is read/write and can be set via code and not just input events. If the SomeControl.SelectedThing property is read-only, then it doesn't really need to exist and the value can be passed in the event arguments as per the second method.
Agree? Disagree? Discuss ...
|
|
|
|
|
Does anybody have an idea on how I can display tournament brackets in windows forms... I developed the code for single elimination now i just need a way to create dynamic brackets... any ideas?
|
|
|
|
|
Hi all
There is a very peculiar requirement on a screen on one of the application i am working on.
I need to show tool tip on every member of dropdownlist (when the list is open)
Is there any way we can do that...
If you have some hints please share.
Thanks in advance
Vikram
I Code...
|
|
|
|
|
Hope this helps:
- Change the DrawMode property of your combo box to OwnerDrawFixed.
- Implement the event DrawItem of the combo box and write there something like this:
ToolTip tt = new ToolTip();
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e) {
e.DrawBackground();
e.Graphics.DrawString(comboBox1.Items[e.Index].ToString(),
e.Font, e.State == DrawItemState.Selected ? Brushes.White : Brushes.Black, e.Bounds, StringFormat.GenericDefault);
e.DrawFocusRectangle();
tt.Show(comboBox1.Items[e.Index].ToString(), comboBox1, 1000);
}
This event is now called whenever an item is displayed. Now you have to insert the text that draws the combo items and, by the way, you update the tool tip with the information you want to show about the item.
|
|
|
|
|
(Note that this post might seem familiar since i already posted it on the MSDN forums which was the wrong place)
Hello,
First of all, sorry for the title and the location of this post. i'm still sure i did something wrong there .
Now for the situation: I have a datasource ( +- 20 mb ) containing more then 100 000 elements where each element contains 4 properties which i need to download from the web.
Then i need to display this datasource in a winforms app. I only need to download this datasource once so it seems logical i save it at the disk for persistence. The datasource is already sorted by name which is good since its a requirement to search for certain elements within the datasource. My goals are to achief the above situation with the least system resources consumption possible ( not that its strictly required but... heck, you know what i mean )
Current progress: I download the datasource chunk by chunk so i can progress one element at a time. When a element got retrieved, i immidiatly create an object out of it and serializes it to the disk to a single file (shared by each element ofcourse) using the XmlSerializer. So far, all goes great, i made a few optimalisations where i dont serialize each element one by one but rather store them in a buffer of X size and serializes the buffer when full, which seems to improve performance.
When all elements are downloaded and stored, i use a listview in detailed view with multiple colums and virtual mode on. As far as i know, this should be one of the most efficient ways of displaying the data. Now comes the real bottleneck. I need to read in the data dynamicly, that is if i need element X to Y and dont want to read in any elements outside that range. XmlSerialization is no go since it always reads in all data, So does XmlDocument (and its rather slow). I cant use XLinq since im targeting .NET 2.0 so i was thinking about XPathDocument. XPathDocument comes with a few drawbacks for what i know. Most importantly, it seems that its loading the entire document in memory which i try to avoid. Next, when for example, scrolling up in the listview, i cant seem to find a way within the navigator to navigate upwards, even better. I cant seem to access a specific element at an index without having to create a new navigator, but these problems might just also be my lack of knowledge of the XPathDocument.
Question: Can anyone help me determine the best way to handle this specific situation?
Note that im not restricted to the above situation so please correct me on ANY part.
Thanks in advance,
Koen
|
|
|
|
|
Firstly I would store the table in a database, SQL Express by preference and Access under duress. All your problems go away when you use a DB as it is designed to serve up smaller chunks that 20mb.
I would then set up a filtering UI so the users can see the minimum number of usable records at any time, I find about 100 to be a good number. It depends on your data structure but with 4 fields there should be some grouping and after that try alphabetical.
I find a datagridview to be dramatically faster loading that a listview, even if the resources are higher.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you for the answer,
I doupt i can use a database since the application is clientside and all data should be handeled clientside. Because this application will be published on the web and i want the app to require the least ammount of prerequisites possible. Therefore, i cant expect the user to have some kind of db software installed (e.g. access or sqlserver) << I just assumed access is only avail when having the packet installed (from the office disk or wherever its located these days). Also, i like to build a mono version in the future so i need to watch out for microsoft specific solutions. (sorry for me not putting all this information in the original post)
Ill do some comparison with the listview vs the datagrid, lets see what happens...
Note that since you named access, i was thinking about using ado.net with a xml provider. Havent used this before though so i dont know if its a advantage. Within my knowledge, ADO.NET still needs to build his indexes for the datastore each time its opened right, they might have optimized memory consumption within this..., ill look into it.
Did i say something ridiculesly stupid up here? if not, does anyone have any other input?
Thanks again,
Koen
|
|
|
|
|
Hi there,
Help required....
I am using SourceGrid in .net winform ... I want to know how to set different fonts in different cells.
Regards,
Balu
|
|
|
|
|
balukg wrote: I am using SourceGrid in .net winform
What is SourceGrid?
Never heard of it.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
This is what I am trying to do:
Public Class MainForm
Private Split As SplitContainer = Nothing
Public Shadows Property IsMdiContainer() As Boolean
Get
Return (Split IsNot Nothing)
End Get
Set(ByVal value As Boolean)
If value Then
If Split Is Nothing Then
Split = New SplitContainer
Split.Dock = DockStyle.Fill
Split.Panel1.BackColor = Color.Aqua
Split.Panel2.BackColor = Color.Wheat
Me.Controls.Add(Split)
End If
Else
If Split IsNot Nothing Then
Me.Controls.Remove(Split)
Split = Nothing
End If
End If
Me.Invalidate()
End Set
End Property
End Class With this code, I should be adding and removing a SplitContainer to my form instead of an MdiClient control. When I set IsMdiContainer in the Properties panel, however, my code is never run and the framework adds the MdiClient . If I can get this running, I believe I can create a custom Mdi set-up that allows for the parent form to have a sizable sidebar.
What am I doing wrong?
|
|
|
|
|
TechBearSeattle wrote: When I set IsMdiContainer in the Properties panel, however, my code is never run and the framework adds the MdiClient.
That is because the designer knows nothing about your class or your implimentation of IsMdiContainer. It calls the original code as Shaddowing is not the same as Overriding. It is important to know the difference.
I've got a blog post explaining the difference with the examples in C#. All you need to remember is that
* virtual = Overridable
* override = Overrides
* new = Shaddows
Method shaddowing Vs. Overloading[^] (in VB parlons)
|
|
|
|
|
That is not quite the answer I wanted; I was using Shadows because IsMdiContainer is not overridable. But it did point me to a workaround.
Basically, I have to create a base form that has the property IsMyMdiContainer , then set the mdi form to inherit from that. This is the only way I can get the property to show up in the Properties window for some reason; apparently the IDE (in Visual Basic, at least) looks to the parent class and not the class itself. Then I use the new property rather than the old one. Not as drop-in-and-go as I would have liked, but it works.
Thanks for the answer.
Oh, and great examples in your blog entry
|
|
|
|
|
Hello evryone,
When i m build my projcet. that is successfully build but when i m debuging they give me this exception . i dont know why. please help me . i did not solved my problem.
what is the meaning of this Excetion. please help me .
Code......
using System;
using System.Xml.XPath;
using System.Data.SqlClient;
using System.Data;
using System.Xml;
using System.Xml.Xsl;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
namespace DatabaseLayer
{
public class DatabaseLayer
{
private MySqlConnection _connection = null;
private string _connectionString = string.Empty;
public string ConnectionString
{
set { _connectionString = value; }
get { return _connectionString; }
}
public DatabaseLayer()
{
//
// TODO: Add constructor logic here
//
}
public bool OpenConnection()
{
ValidateConnectionString();
_connection = new MySqlConnection();
_connection.ConnectionString = _connectionString;
string exx;
try
{
_connection.Open();
}
catch (Exception ex)
{
exx = ex.Message;
_connection = null;
return false;
}
return true;
}
public bool CloseConnection()
{
bool result = true;
try
{
if (_connection.State == ConnectionState.Open)
{
_connection.Close();
}
}
catch
{
result = false;
}
finally
{
_connection = null;
}
return result;
}
public void ValidateConnectionString()
{
if (0 == _connectionString.Length)
{
throw new Exception("No connection string has been supplied");
}
}
public int ExecuteNonQuery(string storedProcedure, MySqlParameter[] parameterArray, MySqlParameter outputParam)
{
int result;
MySqlCommand comm = null;
string msg;
result = 0;
try
{
//ValidateConnectionString();
//conn = new SqlConnection();
//conn.ConnectionString = _connectionString;
comm = _connection.CreateCommand();
//conn.Open();
comm.CommandText = storedProcedure;
comm.CommandType = CommandType.StoredProcedure;
foreach (MySqlParameter param in parameterArray)
{
comm.Parameters.Add(param);
}
outputParam.Direction = ParameterDirection.Output;
comm.Parameters.Add(parameterArray);
result = comm.ExecuteNonQuery();
result = int.Parse(outputParam.Value.ToString());
}
catch (SqlException ex)
{
msg = ex.Message;
}
finally
{
comm = null;
}
// result = SqlHelper.ExecuteNonQuery(_connectionString, CommandType.StoredProcedure, storedProcedure, parameterArray);
return result;
}
public int ExecuteNonQuery(string storedProcedure, MySqlParameter[] parameterArray)
{
int result;
MySqlCommand comm = null;
string msg;
result = 0;
try
{
//ValidateConnectionString();
//conn = new SqlConnection();
//conn.ConnectionString = _connectionString;
comm = _connection.CreateCommand();
//conn.Open();
comm.CommandText = storedProcedure;
comm.CommandType = CommandType.StoredProcedure;
foreach (MySqlParameter param in parameterArray)
{
comm.Parameters.Add(param);
}
result = comm.ExecuteNonQuery();
}
Eror on this line// catch (Exception ex)
{
and there also erro// msg = ex.Message;
}
finally
{
comm = null;
}
// result = SqlHelper.ExecuteNonQuery(_connectionString, CommandType.StoredProcedure, storedProcedure, parameterArray);
return result;
}
public object ExecuteScalar(string storedProcedure, MySqlParameter[] parameterArray)
{
object result;
MySqlCommand comm = null;
string msg;
try
{
comm = _connection.CreateCommand();
comm.CommandText = storedProcedure;
comm.CommandType = CommandType.StoredProcedure;
foreach (MySqlParameter param in parameterArray)
{
comm.Parameters.Add(param);
}
result = comm.ExecuteScalar();
}
// catch (Exception ex)
// {
// msg = ex.Message;
// }
finally
{
comm = null;
}
//ValidateConnectionString();
//result = SqlHelper.ExecuteScalar(_connectionString, CommandType.StoredProcedure, storedProcedure, parameterArray);
return result;
}
public DataSet ExecuteDataSet(string storedProcedure, MySqlParameter[] parameterArray)
{
DataSet result = new DataSet();
string msg;
MySqlDataAdapter da = null;
da = new MySqlDataAdapter();
MySqlCommand comm = null;
try
{
comm = _connection.CreateCommand();
comm.CommandText = storedProcedure;
comm.CommandType = CommandType.StoredProcedure;
foreach (MySqlParameter param in parameterArray)
{
comm.Parameters.Add(param);
}
da.SelectCommand = comm;
da.Fill(result, "data");
}
// catch (Exception ex)
// {
// msg = ex.Message;
// }
finally
{
da = null;
comm = null;
}
return result;
}
public MySqlDataReader ExecuteReader(string storedProcedure, MySqlParameter[] parameterArray)
{
MySqlDataReader result = null;
MySqlCommand comm = null;
comm = _connection.CreateCommand();
string msg;
comm.CommandText = storedProcedure;
comm.CommandType = CommandType.StoredProcedure;
foreach (MySqlParameter param in parameterArray)
{
comm.Parameters.Add(param);
}
try
{
result = comm.ExecuteReader();
}
catch (Exception ex)
{
msg = ex.Message;
}
finally
{
comm = null;
}
// ValidateConnectionString();
// result = SqlHelper.ExecuteReader(_connectionString, CommandType.StoredProcedure, storedProcedure, parameterArray);
return result;
}
public DataTable ExecuteDataTable(string storedProcedure, MySqlParameter[] parameterArray)
{
//SqlParameter[] parameter = new SqlParameter[2];
//parameter[0] = new SqlParameter("@userIDN", SqlDbType.Int);
//parameter[1] = new SqlParameter("@activeFlag", SqlDbType.Bit);
//parameter[0].Value = applicationUserIDN;
//parameter[1].Value = activeFlag;
DataTable result = new DataTable();
string msg;
MySqlDataAdapter dataAdapter = null;
dataAdapter = new MySqlDataAdapter();
MySqlCommand comm = null;
//OpenConnection();
comm = _connection.CreateCommand();
comm.CommandText = storedProcedure;
comm.CommandType = CommandType.StoredProcedure;
//comm.Parameters.Add(parameter[0]);
//comm.Parameters.Add(parameter[1]);
foreach (MySqlParameter param in parameterArray)
{
comm.Parameters.Add(param);
}
try
{
dataAdapter.SelectCommand = comm;
dataAdapter.Fill(result);
}
// catch (Exception ex)
// {
// msg = ex.Message;
// }
finally
{
CloseConnection();
dataAdapter = null;
comm = null;
}
return result;
}
public MySqlDataReader ExecuteReader(string storedProcedure)
{
MySqlDataReader result;
MySqlCommand comm = null;
string msg;
comm = _connection.CreateCommand();
comm.CommandText = storedProcedure;
comm.CommandType = CommandType.StoredProcedure;
// foreach (SqlParameter param in parameterArray)
// {
// comm.Parameters.Add(param);
// }
try
{
result = comm.ExecuteReader();
}
// catch (Exception ex)
// {
// msg = ex.Message;
//}
finally
{
comm = null;
}
// ValidateConnectionString();
// result = SqlHelper.ExecuteReader(_connectionString, CommandType.StoredProcedure, storedProcedure, parameterArray);
return result;
}
}
}
Thanks in Advance
|
|
|
|
|
Someone may be able to answer your question, but I cannot.
Not unless I can see at least a little of your code. Please modify your post to include the relevent part of your code, the part where the error occurs. Point out the line causing the exception.
This will enable those of us without super powers to help you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|