|
Daniel Fowler wrote: Does anyone know if I can call code created in VB 6 from C# 2008?
Yes, you can.
Daniel Fowler wrote: If so, what areas (or keywords) do I need to look up to reaserch this on?
VB6 dlls use COM. It's called COM interop.
Pretty much all you do is VS is add a reference, go to the COM tab, locate the library you want to use. VS will create an interop assembly. (You can look in this assembly to see the details of how the COM stuff is called, if you fancied doing it manually)
Simon
|
|
|
|
|
Cheers mate, I'll get learning!!
|
|
|
|
|
Can any one Help,
I have create Multiple Thread and Call the function in c#.
The Code as follows
using System;
using System.Threading;
namespace ThreadPool
{
public class Program
{
static void Main(string[] args)
{
Program pa = new Program();
Thread firstThread = new Thread(new ThreadStart(pa.Name));
Thread secondThread = new Thread(new ThreadStart(pa.Name));
Thread thirdThread = new Thread(new ThreadStart(pa.Name));
Thread fourthThread = new Thread(new ThreadStart(pa.Name));
Thread fifthThread = new Thread(new ThreadStart(pa.Name));
firstThread.Start();
secondThread.Start();
thirdThread.Start();
fourthThread.Start();
fifthThread.Start();
Console.ReadLine();
}
public void Name()
{
Console.WriteLine("My Name is Bruze" );
Console.WriteLine("GO!!!!!");
}
}
The above code Multiple Thread (firstThread,secondThread,thirdThread,fifthThread,fifthThread) execute one by one.
I want Multiple Thread execute at Same Time(simultaneously) in c#.
modified on Friday, July 11, 2008 7:26 AM
|
|
|
|
|
bruze wrote: How to Multiple Thread Start at Same Time in c#.
You can't predict the order in which threads are executing.
|
|
|
|
|
Considering you can only run once thread at once per cpu, what do you expect to gain from starting multiple threads in one call? (Except code clarity I guess).
|
|
|
|
|
Use backgroundworker so your threads will be working asynchronously with the UI thread. but only one thread will be executed in async mode also otherwise your application will affect the main UI thread resulting in hung up application.
Hope this helps
cheers
Paritosh Tripathi
B.Tech. (C.S.)
|
|
|
|
|
|
Hi,
if you hope to get
MMMMMyyyyy NNNNNaaaaammmmmeeeee iiiiisssss BBBBBrrrrruuuuuzzzzzeeeee
then your code isn't the right one. The Console class is somehow synchronized in an effort to
keep the output readable, so each Console.WriteLine will execute in sequence; the sequence of
the threads will however be random, but since they all emit the same text, you won't notice.
|
|
|
|
|
I have a presenter(int a MVP architecture). The initialization function gets some data from the database. First I populate the comboboxes and then i populate each control with data
IList<payments> payments = _dbOp.GetListOfItems<payments>();
_view.SetCbPaidtoAccount_DataSource(paidToItems, "Text", "PaymentId");
etc...
OrderItem orderItem =_dbOp.GetItem<orderitem>(orderId)
if(item!=null)
PopulateControlsFromItem(orderItem);
</orderitem></payments></payments>
private void PopulateControlsFromItem(orderItem)
{
_view.SetPaymentType_Value=orderItem.paimentId;
etc...
}
My question is.. how would you test the PopulateControlsFromItem method?
|
|
|
|
|
razvan_dme wrote: how would you test the PopulateControlsFromItem method?
It is a private method and you are wondering how to test it, right ? Looks like you have a design issue. Look at the SRP[^] and refactor your class which will make it test friendly.
If you think it is in a good structure, try mocking _dbOp.GetListOfItems() and other codes and test presenter initialization. But it's not a good approach though.
|
|
|
|
|
Ok, in the initialization function i'm getting data from database and then i'm setting this data to my controls, so that means I have broken the SRP, even though the purpose of my method is to fill controls with data taken from the database?
I'm doing the same thing with the method PopulateControlsFromItem - firstly i get info from the database and then i'm filling the controls from view with data. I could get rid of this method and place the code in the initialization function, but the code would look messy.
Can you please give me a suggestion of how I should refactor my presenter class?
|
|
|
|
|
razvan_dme wrote: Can you please give me a suggestion of how I should refactor my presenter class?
It's very tough to do as I haven't seen the whole implementation. As "PopulateControlsFromItem" is a part of presenter initialization, testing presenter initialization would cover this method also. Then assert all the expected initializations are happened. AFAIK, you don't write unit tests for each and every method, you write unit tests for testing a particular functionality. Here it is presenter initialization.
Hope it's clear
|
|
|
|
|
Do you happen to know an open source project so that I can see a view of how MVP architecture is handled and tested?
|
|
|
|
|
I have seen StructureMap[^] which is created by Jeremy D Miller. It's a dependency injection framework which helps to create testable applications. Here[^] is a good MVP implementation with steps to test it. It's in ASP.NET.
|
|
|
|
|
If you have a private member that really needs testing, make it internal and use (off the top of my head) [assembly:internalsvisibleto("MyStuff.Tests")]
|
|
|
|
|
how can i change my sql database to mysql database.Is it possible ?
|
|
|
|
|
Migrating from SQL server to MySQL, right ? Try this[^] tool
|
|
|
|
|
|
ali_reza_zareian wrote: how can i change my sql database to mysql database.Is it possible ?
By removing the " " from "my sql"?
|
|
|
|
|
Hi
This is regarding getting tranparency effect for controls in .net compact framewok(3.5).
I want to have few icons diplayed in the form of tiles with their caption below. For the icons image, I am using png files. These icons I am rendering on a transparent panel which is on top of a form. Now I am getting the transparent effect but the border of the png files is not coming as smooth. Some white color border is getting displayed which makes the image look a bit jagged.
I would be highly obliged to you for any help from your side. For any clarifications please revert.
Thanks and regards
Subasish
|
|
|
|
|
Subasish M wrote: but the border of the png files is not coming as smooth
I believe some good image editors like Photoshop, Paint.NET can remove this and make the image transparent.
|
|
|
|
|
No the same image is looking fine in other applications
|
|
|
|
|
I wanna do the transparency panel can you show me how u achieved it thanks
|
|
|
|
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Reflection;
namespace TransparentSmartDevice
{
public partial class TransparentPanel : ScrollableControl, IControlBackground
{
Bitmap background;
public TransparentPanel()
{
background = new Bitmap(
Assembly.GetExecutingAssembly().GetManifestResourceStream(
"TransparentSmartDevice.Test(240 X 374).JPG"));
}
protected override void OnPaint(PaintEventArgs e)
{
//e.Graphics.DrawImage(background, ClientRectangle,new Rectangle(0,0,background.Width,background.Height),GraphicsUnit.Pixel);
e.Graphics.DrawImage(background,0,0);// ClientRectangle, new Rectangle(0, 0, background.Width, background.Height), GraphicsUnit.Pixel);
}
public Image BackgroundImage
{
get { return background; }
}
}
}
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace TransparentSmartDevice
{
public partial class TransparentPanelBase : ScrollableControl
{
protected bool HasBackground = false;
protected override void OnPaintBackground(PaintEventArgs e)
{
IControlBackground form = Parent as IControlBackground;
if (form == null)
{
base.OnPaintBackground(e);
return;
}
else
{
HasBackground = true;
}
e.Graphics.DrawImage(
form.BackgroundImage,
0,
0,
Bounds,
GraphicsUnit.Pixel);
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
Invalidate();
}
protected override void OnParentChanged(EventArgs e)
{
base.OnParentChanged(e);
Invalidate();
}
}
}
|
|
|
|
|
How can I create a transparent label on top on the panel?
|
|
|
|