|
Are you looking for FolderBrowserDialog ?
|
|
|
|
|
Ah! Thank you very much, thats it.
|
|
|
|
|
Hi all, I've got a problem...
I'm using the wodBeep controls (http://www.softplatz.com/Soft/Development/Other/wodBeep.html) to try and create a client/server application.
The server must maintain a list of the users and as a client sends information to the server, the server should then relay it to the correct subset of users.
The problem is, I can't find a good way of figuring out how to store this information.
At the moment when a client connects it sends a serialized userobject, containing some basic information that is common accross both the server and the client... but I have no idea how to work out which instance of the beep object this should be related to. Below is the relevent code from my project.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using affinityBeepProfiles;
//using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using WODBEEPCOMLib;
using affinitySharedClasses;
using System.IO;
using System.Xml.Serialization;
using System.Collections;
namespace affinityServer
{
public partial class frmMain : Form
{
private wodBeepCom myBeep;
private affinityBeepProfile myBeepProfile;
private BeepTransportTCP myBeepTCP;
private user myUser;
private int beepCount = 0;
private Hashtable myUsers = new Hashtable();
public frmMain()
{
InitializeComponent();
}
private void myBeep_Disconnected(int errorCode, string errorText)
{
txtStatus.Text += "[Client disconnected]";
if (errorCode > 0)
{
txtStatus.Text += " - " + errorText;
}
txtStatus.Text += "\r\n";
}
private void myBeep_Connected(object PeerInfo)
{
txtStatus.Text += "[Client connected]\r\n";
//add this current beep interface onto myUsers
myUsers.Add(beepCount, myBeep);
BeepMessage beepMessage = new BeepMessage();
beepMessage.Body = "BIN\r\n" + beepCount;
beepMessage.Type = MessageTypes.msgOther;
myBeep.Transport.Send(beepMessage, 0);
//create new beep instance
createNewBeep();
txtStatus.Text += "{new BEEP instance created}\r\n";
}
private void frmMain_Load(object sender, EventArgs e)
{
createNewBeep();
txtStatus.Text += "[server started]\r\n";
}
private void btnStop_Click(object sender, EventArgs e)
{
btnStart.Enabled = true;
btnStop.Enabled = false;
myBeep.Stop();
txtStatus.Text += "[stopped]\r\n";
}
private void btnStart_Click(object sender, EventArgs e)
{
btnStart.Enabled = false;
btnStop.Enabled = true;
myBeep.Start();
txtStatus.Text += "[started]\r\n";
}
private void createNewBeep()
{
myBeep = new wodBeepCom();
myBeepProfile = new affinityBeepProfile();
myBeepTCP = new BeepTransportTCP();
myBeepTCP.DebugFile = "C:\affinityDebug.txt";
myBeepTCP.Port = 4397;
myBeep.Transport = (BeepTransport)myBeepTCP;
myBeepProfile.isServer = true;
myBeep.Profiles.Add(myBeepProfile);
myBeep.Role = BeepRoles.ListenerRole;
myBeep.Start();
//here is as good a place as any for events? :S
myBeep.Connected += new _IwodBeepComEvents_ConnectedEventHandler(myBeep_Connected);
myBeep.Disconnected += new _IwodBeepComEvents_DisconnectedEventHandler(myBeep_Disconnected);
myBeep.ChannelOpen += new _IwodBeepComEvents_ChannelOpenEventHandler(myBeep_ChannelOpen);
myBeepProfile.msgReceive += new affinityBeepProfile.onReceive(myBeepProfile_msgReceive);
++beepCount;
}
void myBeepProfile_msgReceive(object sender, onReceiveEventArgs e)
{
switch (e.messageAction)
{
case "UOB":
txtStatus.Text += "[user object] - ";
Stream myStream = new MemoryStream(ASCIIEncoding.Default.GetBytes(e.strBody));
XmlSerializer mySerial = new XmlSerializer(typeof(user));
myUser = (user)mySerial.Deserialize(myStream);
myStream.Close();
txtStatus.Text += myUser.affinityName.ToString() + "\r\n";
break;
}
}
void myBeep_ChannelOpen(BeepChannel Channel)
{
txtStatus.Text += "[new channel created] - " + Channel.ID + "\r\n";
}
}
}
Perhaps more information is needed in order for me to get help on this problem, but any insight would be great (I'm willing to give any more information that I can should anything more be needed to gain an understanding of what I'm trying to do - this isn't some top secret endevour )
Cheers all
|
|
|
|
|
Hi evreyone!
The problem is: having approx. 5000 files in about 400 directories. And with lots of clones. The point is to have a program that creates a TTH-code catalogue with evrey file hashed (exept for sistem files) ignoring the file name, and then shows all duplicates. Preferably giving a choice to delete not needed articles by parameters ( like "date created", "shorter folder root" etc.)
Could somebody create a kind of such a program, please? Or at least tell me where to find a ready one?
An idea asks for prooveing. And the prooved one for full-filling. Doesn't it?
|
|
|
|
|
hi!
i've made a mesh in blender (open source 3d graphics creation)
some screenshots and the mesh
unfortunately the mesh doesn't look good when i load it into my device
then i heard that it might have to do with the smoothing of the mesh
so how can i turn it off?
thx, kopi_b
|
|
|
|
|
Hi,
I have a problem with the DomainUpDown control of the Windows Forms. I have a list of numbers listed in the items (such as 300, 180, 150, 120, 90, 60, 45, 20, 10, 1, 0.5, 0.25). I have the text of the control set to 1. When I click on the up button of the control nothing happens. Then when I click on the down button of the control nothing happens the first time but then works when I click on it the second time. After this the up button also starts working. But this would be frustrating to the end-user if this kind of stuff happens. Please help.
Thanks
Vijay
|
|
|
|
|
Hey got it. Solved the problem by setting the control's selected item index to the corresponding text that I set for the control.
Vijay
|
|
|
|
|
Hi,
after reading a lot of forum threads i am wondering that no one else has the problem I am having. Here it is: I am starting programming with C# and .NET with VisualC# Express. I tried to implement multithreading in my test app. The app runs but when I set breakpoint in the code that is executed by a worker thread then:
- the debugger stops at the breakpoint
- the GUI freezes for a couple of seconds and then
- I am not able to get the interrupted thread running again
I have written a small test application to demonstrate this behaviour. It opens a form with a button and 4 textboxes. When the button is pressed 4 threads will be started, that increment a local variable and display the value of the variable in the textbox (each thread has its own textbox). When the threads are running I can see that the numbers in the textboxes are increasing. When I set a breakpoint in the thread code, the execution stops. I must wait a few seconds before the GUI (VC) responds and if I then let the app run again (after removing the breakpoint) I can see that the thread that was interrupted does not work anymore (textbox value does not change).
What could cause this behaviour. I think that I am having a general problem but I dont know where to start to search.
The source of the test application:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace MTWindowsTestApp
{
public partial class Form1 : Form
{
int m_nThreadCount;
bool m_bExit;
public Form1()
{
InitializeComponent();
m_nThreadCount = 0;
m_bExit = false;
}
private void button1_Click( object sender, EventArgs e )
{
Thread t;
int i;
for( i = 0; i < 4; ++i )
{
t = new Thread( new ParameterizedThreadStart( MyThread ) );
t.Priority = ThreadPriority.BelowNormal;
t.Start( new ThreadData( m_nThreadCount++ ) );
}
}
public delegate void SetTextDelegate( string strText,
ThreadData td );
public void SetText( string strText, ThreadData td )
{
switch( td.m_nNr )
{
case 0:
{
textBox1.Text = strText;
break;
}
case 1:
{
textBox2.Text = strText;
break;
}
case 2:
{
textBox3.Text = strText;
break;
}
case 3:
{
textBox4.Text = strText;
break;
}
}
}
public void MyThread( object Data )
{
int nCount;
int nData = ( (ThreadData)Data ).m_nNr;
string strTemp;
nCount = 0;
strTemp = nData.ToString();
while( true )
{
strTemp = "Thread " + nData.ToString() + ": " +
nCount.ToString();
BeginInvoke( new SetTextDelegate( SetText ),
new object[] { strTemp, Data } );
nCount++;
Thread.Sleep( 10 );
}
}
private void Form1_FormClosing( object sender, FormClosingEventArgs e )
{
m_bExit = true;
}
}
public class ThreadData
{
public int m_nNr;
public ThreadData( int nNr )
{
m_nNr = nNr;
}
}
}
Thanks in advance.
|
|
|
|
|
Hmph... I can't reporoduce your error... everything works fine, and your code looks solid.
Only thing that I added is t.IsBackground = true; when you declare thread or else application crashes when you close it in middle of work... try with that line.
|
|
|
|
|
Adding that line makes no difference. To be more clearly, the code works on my machine too. But I am not able to stop the worker thread with a breakpoint. If I do, it wont ever run again.
|
|
|
|
|
I have noticed furthermore the following: The first thread that gets halted by the debugger does not respond anymore. The remaining threads can be halted and executed stepwise. No problem. It is only the first time a thread gets halted, that this thread does not work anymore. As there seems to be no one with that problem (besides me), I assume that there must be a problem with the configuration of my machine.
I have two machines with VC#8 and both have this behaviour. On both machines is installed:
- Windows XP SP2
- VisualC++ 6 Enterprise
- VisualC# Express
- WindowsXP SP2 SDK
Do I have to be member of a special group (Windows User Group) for the debugger to work correctly?
Anyone any other idea???
|
|
|
|
|
Hi,
I have found the reason for this behaviour (although I think that it is a bug). The problem is the "Locals" window in the debugger. It shows the local variables of the current context and "this". And this is the problem. If I switch to the window "Überwachung" (maybe "Watch" in english?), the problem is not there. If I put "this" in the watch window, the problem is there again.
Summary: If we set a breakpoint in our application inside thread code and the "local" window is open when the thread reaches the breakpoint so that execution stops, the halted thread is dead from now on.
I am still wondering that no one else had this problem...
|
|
|
|
|
I created a table that the first column is "ID",Fname,Lname.
the "ID" is set to be primary.
when i am doing the insert command: "insert into table (Fname,Lname) values (y,t)"
i get and error that says that ID can not get NULL, i thought that it should be increased automatically.
the error:
Cannot insert the value NULL into column 'ID', table 'RTQ.dbo.Users'; column does not allow nulls. INSERT fails.
The statement has been terminated.
I do not want there NULL, i created it "int" so it could put nubers there.
what am i doing wrong???
Thanks
|
|
|
|
|
First this is the C# board and not the SQL board. Posting on the right board will get you answers faster.
What you need to do is have the ID field set up as an identity field so that it will increment automatically.
Steve Maier, MCSD MCAD
|
|
|
|
|
hi guys,
I have a picBox and a list of pictures. These pictures are displayed in ordered by 2 button ( previous and next ) in the picBox. When clicking buttonDelete, I want to delete the picture which is being displayed in picBox at present and then,another pic is displayed in picBox. But,if any pictures were displayed in the past, it couldn't be deleted. (error: ... because it is being used by another process.)
F1 - help me . thanks !!!
-- modified at 13:53 Monday 27th February, 2006
|
|
|
|
|
Hi!
How are you trying to delete the image displayed in the PictureBox ? To get an empty PictureBox you can simply assign null to the Image property.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I only want to delete the picture displaying on PictureBox,and then the pictureBox will display next( or previous) picture in my list Picture.
-- modified at 21:26 Monday 27th February, 2006
|
|
|
|
|
Still not sure what you really want.
Are you trying to delete the file the picture has been loaded from or something else? Please be more clear.
And if you try something already and "it does not work", then the exact error message you get is essential for us to help you.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
yes, i'm trying to delete the picture file has been loaded into PictureBox.
I think the picture that has been loaded into PictureBox is saved into a "temp" memory or something else,isn't it?
|
|
|
|
|
Ok, now that we know what your problem is, we can help you...
You have to make sure the image file isn't being used any more.
The most probable cause is that the image that has been assigned to the PictureBox hasn't been disposed of yet.
First, you'll have to make sure you don't let any old references hanging around when you load an image into your PictureBox. For example, when setting an image to display you could write
if (pictureBox1.Image != null)
{
pictureBox1.Image.Dispose();
pictureBox1.Image = null;
}
pictureBox1.Image = newImageToShow; That way, only the image currently shown in the PictureBox is used.
Before you can delete the file, you'll also have to remove any references, for example:
private void buttonDelete_Pressed(object sender, EventArgs e)
{
pictureBox1.Image.Dispose();
pictureBox1.Image = null;
File.Delete(pathToCurrentImage);
}
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
oh, pictureBox1.Image.Dispose(); thanks !
Then,can i ask you about form size?
I have an user control added into a form. I used the following code in both Form_load() and Form_SizeChanged but the usc size wasn't changed:
uscImage_NEW.UserControl1 usc=new uscImage_NEW.UserControl1();
private void Form1_SizeChanged(object sender, System.EventArgs e)
{
usc.Left=0;
usc.Top=0;
usc.Width=this.Width;
usc.Height=this.Height;
}
how to solve this problem?
|
|
|
|
|
Why don't you just anchor or dock the UC?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I did with another objects such as one button, one lable or anything else in another project... its size was changed. In usc project, i tried but the usc size was unchanged.
|
|
|
|
|
Hi
After deploying ASP.net 1.1 application, when a user hits a page first time, it takes lot of time to load because MSIL code needs to be translated to native format. But, if we have several pages in application, it can give bad impression that the site is slow.
Is there a way after deploying, I can automatically turn all the pages from MSIL to native format for fast loading?
Please advice.
Thanks
Pankaj
|
|
|
|
|
Hi!
You'd want to start reading on a tool called ngen (part of the framework sdk).
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|