 |
 |
Index ‹ DotNet ‹ Net Framework
|
- Previous
- 1
- ADO >> Fun with products and Expression columnsI have somewhat of an interesting scenario:
The form allows the user to select a service, which populates a a grid of
product information related to that service ("service grid"). The user can
then select from the products in the first grid and those choices populate
the second "choices grid".
The product grid is bound to a strongly-typed dataset table which can be
filled in a couple of different ways. More on this shortly.
The choices datatable contains expression columns related to a product
table. So if the user choses Widget A, B, and C, the product prices and a
lot of other details for that service are reflected into the choices grid
without those values actually being duplicated into the choices table.
All of the structure works well technically. But there is a fundamental
concept decision to be made. That decision is in how to populate the
products table. At some future date, the product catalog may grow to be
50,000, 100,000 or even greater. My instinct is to individually populate the
products datatable with ONLY the Widgets that relate to Service1 when it is
selected, and then ONLY populate the widgets that releate to Service 2 when
it is selected (each service requires a subset of the entire product
catalog, thus limiting how big the product table may be).
Where this becomes problematic is that the user may need 2 or more Services.
So if they select products that relate to Service 1, Service 2, etc., then
the catalog to be displayed must grow much bigger. Displaying just one set
of products at a time will not work because this would cause a partial
display of the expression columns in the choices grid (since the
non-populated products still have a primary key back to the products table,
they display a row, but not the expression data).
The easiest answer would be to just populate the entire catalog in the
products grid. Of course, the easiest solution is the most expensive in
terms of database and processor resources. The next easiest answer would be
to populate the product grid with just one set of products at a time. But
this creates the above-mentioned issue with the expression columns.
The technical implementation is not an issue. I'm just looking for some
ideas or thoughts from anyone who has been down this road with multiple
grids and expression columns.
- 2
- Visual C#.Net >> Little clarificationHi
Ok in my app i have some classes that will only ever have one instance. All
of which i make Singletons.
I also have another class that acts like an easy access wrapper for any db
access. Again this is a one time instance.
If it wasn't a one only instance is there a danger in db access? Such as two
threads calling the same method and updating something incorrectly?
Should i make that class a singleton, or make all the methods in that class
static? Since a singleton returns a static instance, does that not do the
same as setting all methods to static?
To be clear an example of one method is like this:
public DataSet GetCustomer()
{
return runProcedure("sp_Customers");
}
Thanks in advance
- 3
- Net Framework >> SQL - all users access db using same username - what licence required ?Hello,
I have an aspx app using 2005 express and need to upgrade to standard
edition to get the features i require.
My initial thinking was a single processor licence for 2005 standard edition
as you get unlimited user connections.
The app is designed so that no matter how many users connect to the website
they always execute with the same username via stored procedures to SELECT /
INSERT data (user authentication is handled by app).
If this is the case do i just need a single user for SQL server standard
edition ?
I will easily have 2 - 10 users connecting per second to INSERT or SELECT
data by running a stored procedure then disconnecting again. At the moment
all users execute using same login passed by the app to the sp that has the
appropriate rights.
Im not sure that spending £3000 on a single cpu licence would be the correct
way forward.
I understand that if you need 25-30 users that a single cpu licence would be
more economic.
Thanks for your time and any help.
Scott
- 4
- Microsoft Project >> DurationI have a task that requires that 3 different resources each work 8 hours in a
single day to complete a task:
Work - 24 hours
Duration - 1 day
I have tried all task types and have enabled and disabled effort driven
scheduling. I have confirmed that 1 day is set to 8 hours in the project
calendar. All 3 resources are assigned at 100% and they are not assigned to
any other tasks in the project right now. I have also confirmed all 3
resources are available 8 hours/day.
Can anyone help me understand how I can get Project to set duration to 1 day?
- 5
- Visual C#.Net >> Moving the drawing origin to the bottom left cornerI have spent hours through newsgroups and googling but I am at a loss
how to move the drawing origin from the top left corner to the bottom
left corner and have Y values increase towards the top.
All the stuff I find shows stuff like this:
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen pen = new Pen(Color.Blue);
Matrix mm = new Matrix();
mm = new Matrix(1, 0, 0, -1, 0, 0);
g.Transform = mm;
g.DrawLine(pen, 0, 0, 100, 100);
}
But nothing gets drawn. What am I missing?
Thanks
Johann
- 6
- Visual C#.Net >> CommandBar for VS.NET IDEHi
I want to customize our IDE. I developed some Add-ins and would like to create command bar to access them directly.
I'm not sure if the term of "command bar" is appropriat. I mean with it a group of icon like the standard one of VS.NET to create a new project or a new element ..
How can I to do ? Has someone a link for me
ti
Samuel
- 7
- Visual C#.Net >> Enumerate Classes in a Namespace?Within the currently executing assembly, I would like to enumerate all
classes that exist in a particular namespace, then instance each of
them and place them into an ArrayList. How can I do that?
Thanks.
- 8
- Microsoft Project >> Format Gant Bar problemHi
Tried to format Gant Bar based on your description with custimize a flag
field with a formula and create a new bar in the bar styles dialog.
It doesnt work.
The formula works for the resourse "Bygg", cause the flag is set to "Ja"
("Ja" means "Yes" in english).
The problem is that when I add "Bygg" to a task, the format doesnt change.
Any ideas of what I do wrong here?
--
TomH
- 9
- 10
- Visual C#.Net >> Collection property not workingHello,
I am designing a .net custom control in VS.net 7.1 and my control exposes an
array of strings which are supposed to be the items to show. To do this have
declared a private string[ ] variable and a public property which returns
it.
string[] options = new string[1];
public string[] Options
{
get
{
return options;
}
set
{
options = value;
}
}
It works fine in the disigner and I can add items to the list using the
VS.net string collection editor and see the changes in real-time. But when I
run the App, I recieve this error:
Cannot create an object of type 'System.String[]' from its string
representation 'String[] Array' for the 'Options' property.
Even with other types of collections (objects, etc.), I receive this error.
What should I do.
- 11
- Microsoft Project >> How to show/hide non-working time based on task calendar in ProjecQuestion: Is there a way to have all tasks that use the one calendar be
hidden behind the non-working time bars while tasks that use another calendar
are shown in front of them?
Background:
I'm using multiple calendars in MS Project 2003, one for regular working
hours and one for overtime working hours. The regular calendar is a
standard, 8-5, 40 hour work week with the company's holiday information
included. The overtime calendar is contains only 8 hour (8-5) days
throughout.
Management prefers that the non-working time in the Gantt chart view cover
(hide) task bars that cross over between weeks. For example, if a task is
using the standard calendar and needs to over lap two weeks, the part of the
task bar that overlays the weekend needs to be hidden by the non-working time
bar (since weekends aren't part of the standard calendar).
The regular calendar is set as the Project's default (standard) calendar.
The thought was that if overtime would be needed to complete a task on time,
then this could be shown by switching the task in question to the overtime
calendar. Then the Gantt chart would visually reflect which tasks had needed
overtime work to be completed on time.
Verbose question:
The problem is that all tasks are overlapped by the non-working time bars,
regardless of which calendar the task is assigned to. Overtime tasks as well
as regular calendar tasks are hidden behind non-working time grey bars.
I'm wondering if there is a way to have all tasks that use the standard
calendar be hidden behind the non-working time bars while those tasks that
use the overtime calendar are shown in front of them. Thanks.
- 12
- Winforms >> Use MeasureString to determine required heightI'm trying to create a label control in VB.NET2005 that will automatically
change it's height to fit the content. To do that i'm using MeasureString to
determine required height for a set width.
What i found is that MeasureString sometimes returns the height which is
smaller then it should be and it seems to depended on the width.
So the question is am i doing something wrong or it's a bug. If it is a bug,
can someone recomend a reliable workaround.
Here is a code that used to test this. When width is set to 570, the last
line is not visible. When it's set to 590 all is OK.
Sub TestMeasureString(ByVal g As Graphics)
Dim s As Size
Dim f As Font = New Font("Arial", 11.25, FontStyle.Regular,
GraphicsUnit.Point)
Dim str As String = New String("W"c, 1000) & " END"
s = g.MeasureString(str, f, 570).ToSize
's = g.MeasureString(str, f, 590).ToSize
g.DrawRectangle(Pens.Black, New Rectangle(New Point(0, 0), s))
g.DrawString(str, f, Brushes.Black, New Rectangle(New Point(0, 0), s))
End Sub
- 13
- ADO >> Application needs replicationHi
We have an MS Access application which runs on the server but some laptop
users need the app to work offline. Our solution has been to use Access
replication which automatically syncs data (both ways) when laptop is
connected to the network. We are looking to rewrite the app to vb.net/sql
server. My question is how does replication work in sql server specially in
context of a vb.net front end i.e. what sort of coding/configuration we are
we looking at?
Thanks
Regards
- 14
- Visual C#.Net >> Need help ... how to find if form is closed?Iv got a little bit of a threading problem.
Iv got a form which handles events fired by an object running on
another thread (the event handlers are executed on a thread differnet
from the form's gui thread). Im using BeginInvoke to call methods on
the form that manipulate its GUI elements, as is reuqired. The problem
is this: When that particular form is closed and the object is still
running, the events still fire and get caught by the event handlers.
The BeginInvoke call fails with an InvalidOperationException (something
about the window handle not being created). Although i can catch this
excpetion and ignore it, doing this would slow down my prgoram alot and
would break the guideline of not having exceptions thrown during normal
program execution (it is normal for this form to be closed, as it is a
helper form). How do i check if the form is open and has a window
associated with it?
- 15
- Winforms >> Special minimizationHi,
I'm developing with Visual Basic .Net 2003.
I want that when the user minimizes my program, it appears near the clock
and the messenger icon.
Is possible to do it with .Net?
Thanks,
Oriol
|
| Author |
Message |
MCEJunkie

|
Posted: Mon Jan 05 11:03:24 CST 2004 |
Top |
Net Framework >> Serializable Collections
It seems that the only .NET Collection classes that are
serializable derive from Hashtable. I am planning on
remoting collections and wanted to use something more
like a CollectionBase. Any suggestions on how to do this
without a hashtable collection?
Thanks,
Mark Phillips
DotNet148
|
| |
|
| |
 |
Mickey

|
Posted: Mon Jan 05 11:03:24 CST 2004 |
Top |
Net Framework >> Serializable Collections
CollectionBase and other collection types *are* serializable. If you're
happy with default serialization semantics, you can be serializable and not
inherit from ISerializable:
[Serializable] class Foo { }
--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"Mark Phillips" <EMail@HideDomain.com> wrote in message
news:091f01c3d3ab$fb26acb0$EMail@HideDomain.com...
> It seems that the only .NET Collection classes that are
> serializable derive from Hashtable. I am planning on
> remoting collections and wanted to use something more
> like a CollectionBase. Any suggestions on how to do this
> without a hashtable collection?
>
> Thanks,
> Mark Phillips
|
| |
|
| |
 |
Mark

|
Posted: Tue Jan 06 10:21:23 CST 2004 |
Top |
Net Framework >> Serializable Collections
Thanks Mickey. I have your book and I have found it
really helpful
Mark
>-----Original Message-----
>CollectionBase and other collection types *are*
serializable. If you're
>happy with default serialization semantics, you can be
serializable and not
>inherit from ISerializable:
>
>[Serializable] class Foo { }
>
>--
>Mickey Williams
>Author, "Microsoft Visual C# .NET Core Reference", MS
Press
>www.servergeek.com
>
>
>
>"Mark Phillips" <EMail@HideDomain.com>
wrote in message
>news:091f01c3d3ab$fb26acb0$EMail@HideDomain.com...
>> It seems that the only .NET Collection classes that are
>> serializable derive from Hashtable. I am planning on
>> remoting collections and wanted to use something more
>> like a CollectionBase. Any suggestions on how to do
this
>> without a hashtable collection?
>>
>> Thanks,
>> Mark Phillips
>
>
>.
>
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ Net Framework |
- Next
- 1
- Winforms >> Cancel windows message from reaching parentI am developing a set of controls that must function inside of an application
that loads them through COM interop (I don't believe that makes a
difference). The application is designed to always handled the "Enter" key.
One of my controls is a text box which needs to allow the user multiline
input and not being able to use the "Enter" key is borderline unacceptable.
I have tried to override WndPRoc, PreProcessMessage, and a host of other
behaviors, but I cannot get the application to stop catching the enter
message.
I have written all messages to a text file when I transition using enter
versus using a mouse click, and I cannot even find a message that indicates
my control received an "Enter" at all.
All suggestions welcomed.
- 2
- Visual C#.Net >> Fade PictureBoxHi everyone I'm new to winforms from asp.net and I'm trying to fade in/out
an image in a picturebox on a winform. I'm doing research and I've found
things like opacity for the winform, but I haven't had any luck with a
picture box.
Can someone please point me in the right direction?
Thanks,
Ben
- 3
- Winforms >> Custom DataGridView Columns and CellsHi,
I have an application with a DataGridView that displays a Questionnaires
questions and allows a user to fill in answers to these questions in the
gridview.
Each question knows its questionType (Date, Text, or Yes/No/Na). I have
created a custom column that inherits from datagridviewcolumn and have
created a custom cell that inherits from DataGridViewTextBoxCell.
In my cell object, I get the OwningRow.DataBoundItem to reference the
QuestionObject and then Get the QuestionType of the question in that row.
After I do this, I use a select case statement to determine the type of
editing control I need for Edit purposes. This way, Date questions get a
datepicker edit control, YES/NO/NA questions get a combobox edit control and
Text questions get a text box edit control.
I have my DataGridView displaying the correct type of editing controls when
edit mode is entered on the cell. And my Text Box and DatePicker Edit
controls seem to be working right as well.
I am having a problem with the ComboBox edit control for my custom cell.
Even though I specify the Items list for the combobox, when the combobox is
displayed, none of the items show up in the dropdown and even if I type an
answer in the combobox, it doesn't enter edit mode.
There are also some other strange behaviors going on in terms of values
displayed when entering edit modes and in display mode.
I would really appreciate any help here I can get. This has been a big
problem for me to solve and have gotten close, but not yet complete.
Thanks so much in advance for your help.
Guy
- 4
- 5
- Microsoft Project >> Resource Assigment Dates Not Matching Task Level DatesResource Assignment Dates not the same as task level dates.
For Example:
Task: Build Radio - 40 days dur. 1/30/06 to 3/24/06
Resources: John 100hrs & Bill 60hrs.
I want both John and Bill's hours spread evenly across the duration, however
my schedule now in the task usage view shows only John (resource with most
hrs) spread across the duration and Bill's hours are at a much shorter date.
I want them both spread evenly across the entire duration. All of my tasks
are fixed work and they need to stay that way. I can manually go into task
usage and fixed the dates, however once status is taken Project reverts back
to the above.
Is their a setting in project I am missing?
Is it because of fixed work?
Please help!!!!
Thanks,
KG
- 6
- Visual C#.Net >> Getting local admin groups and users on a windows server using ADSIhi all,
i am trying to get local admin users and groups on a windows server.
here is the C# code that i am using
***************************************************************************************************
DirectoryEntry AD = new DirectoryEntry("WinNT://" + sServerName +
",Computer",UserName,Password);
DirectoryEntry admGroup = AD.Children.Find("Administrators", "Group");
object members = admGroup.Invoke("Members", null);
foreach(object member in (System.Collections.IEnumerable)members)
{
DirectoryEntry user_groups = new DirectoryEntry(member);
// do some work.
}
******************************************************************************************************
I have 2 issues here.
1. Its not getting all the local users and groups from the
Administrators group on the box.
2. How does it know which domain to look for with just "WinNT://" +
servername.... i have 2 domains, test and production and both domains
have same server names. i.e there is a AppServer in each of the test
and production domain.
3. Is there a different syntax to tell the DirectoryEntry object to
look at a particular server on a particular domain?
thanks,
shashank kadge
- 7
- ADO >> File format for a new application(I know it's a seond post, but I think I explain it better this way)
--
On my own I'm writting an application for the general public.
(a bit like word, except it has nothing to do with word ;-)
So far I used an embeded database engine to store the data (SQLite), I like
the concept because this way I could load/delete/updata whatever data I need
incrementally on demand. And I could also easily perform search.
What gets me more and more concerned is that creating a new (empty) file
(with just about 10 table, 30 index & triggers) takes up to 7 seconds!
Very bad user experience.
I'm considering my options and will gladly takes advice as I'm a bit daunted
by the work involve just to test.
- I was thinking to try an other embeded database engine, such as Firefox.
- I was thinking to use tar-gzipped serialized file (think XML serialization
should be better as it would be probably be better at version resistance
(but worst perf?)), but I was wondering about the wisdom of having all my
data in memory...
- any other ideas?
- 8
- Visual C#.Net >> Order of Columns in the Datagrid binding.Hi, Dear gurus,
I want to bind my collection to a datagrid. The field names in my object
show up in a weird order, and I just wonder how I could reorder those
columns .
I find some code like the following , but I don't want to do it that way
because it won't work if I have large number of fields.
[
DataGridTableStyle myGridStyle = new DataGridTableStyle();
myGridStyle.MappingName = "GridTableMappingName";
DataGridTextBoxColumn nameColumnStyle = new DataGridTextBoxColumn();
nameColumnStyle.MappingName = "GridColumnMappingName";
nameColumnStyle.HeaderText= "GridColumnMappingName";
myGridStyle.GridColumnStyles.Add(nameColumnStyle);
myDataGrid.TableStyles.Add(myGridStyle);
]
I believe there must be some better way to do that(using reflection) .
Anybody gives me some hint on that. A link to a example is highly
appreciated.
Thanks,
J.W.
- 9
- Dotnet >> How do I build the project sample to detect and install CFHello friends
I have got a sample code from msdn in the following link.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/netcfdepl.asp
but i am not understanding how to build this project and how to get the .msi
file to start the setup.
if u know please help.
with regards
Meghna
- 10
- ADO >> Connection Pool Time OutHi all,
I have the following scenario:
App1: Asp.Net Application that shows reports from some SQL DB
App2: Asp.Net WebService with two services exposed for clients, and a single
â??Checkerâ?? in the Application object that checks every some time (normally 2
or 3 minutes) for conditions in the same DB, and insert some values in it
using a transaction.
When the time spans completes, the checker retrieves via a SqlDataReader the
ready items and make the insertions as shown:
SqlDataReader reader = GetReadies();
try
{
// do something
// initialize the transaction â??transâ?? and the connection â??conâ??
try
{
// insert using the transaction
trans.Commit();
}
catch(Exception ex)
{
trans.Rollback();
throw ex;
}
finally
{
trans.Dispose();
con.Close();
}
}
finally
{
reader.Close();
}
In the web application I have few pages that get information from the DB,
and after a few retrievals, I got this error:
â??Timeout expired. The timeout period elapsed prior to obtaining a connection
from the pool. This may have occurred because all pooled connections were in
use and max pool size was reached.â??
So I review all code searching for unclosed datareaders or connections, for
nothing. I use SQLHelper in the web application and I always retrieve
datasets, anyway, I checked that all connections were closed.
Then I review the code in the webservice app, I think it is correct, isnâ??t it?
Even though I didnâ??t found unclosed connections, I started to watch the .Net
CLR Data performance object with the object Current # pooled connections. The
graph never goes over 7 connections; it oscillates between 5 and 8. I also
started a new trace in the SQLProfile to see if it audits logout events
occurs.
And still, after a while browsing in the asp.net application, I receive the
same error.
Note: the max pool size is set to 100 explicitly.
Any idea of the cause?
Thank you very much.
- 11
- Visual C#.Net >> Question: Load bmp and save as jpgI want to convert one bitmap file to another one.
For example load as bmp and save as jpg.
The loading part is simple I do this:
Stream BitmapStream =
File.Open(sSrcFile,FileMode.Open,FileAccess.Read,FileShare.None);
Bitmap imgPhoto=new Bitmap(BitmapStream);
iPixelsX=imgPhoto.Width;
iPixelsY=imgPhoto.Height;
BitmapStream.Close();
The saving will be something like this; but I fail to see how I can hook up
imgPhoto from the load to this stream.:
Stream DestBitmapStream =
File.Open(DstFile,FileMode.CreateNew,FileAccess.Write,FileShare.None);
// how do I connect imgPhoto?
DestBitmapStream.Close();
Also I wonder if the Pixelfomat is different, lest say I load 8 bit indexed
color palette bitmap and want to save as 24 bit RGB jpeg, could this be done
automatic?
Something tells me that I need to copy the bytes manually??? I hope not.
Many thanks.
Olaf
- 12
- Visual C#.Net >> Layout manager issue when docking panels?I was playing around with a new Windows form yesterday. I wanted to drop two
panels on the form. The first would be set Dock=Top. The second would be set
Dock=Fill.
So, I dropped the first panel and set its Dock property to Top. I then dropped
the second panel on the form and set its Dock property to Fill.
Holy disappearing panels, Batman. The second panel filled the entire form
hiding the first panel. So, when I dropped my grid control on the second panel
which was set to Dock=Fill, it filled the entire screen.
I eventually got what I needed by cutting and pasting the controls, which was a
suggestion of a fellow developer at work, but it was a bit annoying.
Is there a bug in the layout manager in the forms designer that is causing this
behavior?
- 13
- 14
- Visual C#.Net >> Anonymous type etc. in C# 3.0I understand, basically, what this C# 3.0 code does, but I am unclear
on how it determines the data type of num and index in the lambda
expression in the following code. Nor can I see how it gets the array
index into the index parameter?
BTW: Is there a better forum for asking these questions?
public void Linq12() {
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
var numsInPlace = numbers.Select((num, index) => new {Num = num,
InPlace = (num == index)});
Console.WriteLine("Number: In-place?");
foreach (var n in numsInPlace) {
Console.WriteLine("{0}: {1}", n.Num, n.InPlace);
}
}
- 15
- Winforms >> Unable to hide form? in .NET 2.0Any suggestions on how to make a form not visible when displayed via
Form1.ShowDialog() ?
If I put a button on the form called "Close" and in the click event I put
Me.visible = false, the form closes and my application terminates. I don't
want this, I just want it to hide (Me.Hide is the same as Me.visible).
I'm using a module1.vb with a sub Main() from the sub Main I Dim Form1 as
New myForm and then call the Form1.ShowDialog.
I can't find any way to hide a Form that is initially displayed (Modal) via
ShowDialog which closing the form. Is this just not possible in .NET 2.0
Rob.
|
|
|