|
hi there!
can i know how to set the date format of the calendar in a datetimepicker?
actually i know it can be set in the regional settings of your machine but how about during run-time?
any suggestions or ideas will be very much appreciated!
tnx in advance!
|
|
|
|
|
Hi
public void SetMyCustomFormat()
{
// Set the Format type and the CustomFormat string.
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
}
Hope it helps
|
|
|
|
|
hello!
I already tried that before i post and it only change the text of the datetimepicker. the calendar still has the format that is set on your regional settings.
anyway, tnx for the reply!
|
|
|
|
|
What is static and Dynamic Assemblies?
What is the use of these Assemblies in our project ?
|
|
|
|
|
This is a forum for asking for specific help with programming questions, usually requiring code, and a description of a problem.
Google is a tool which can be used for general research, including but not limited to, homework.
|
|
|
|
|
Hi.
I am working on a project in which I need to encrypt data I am storing in MySql Database.There are many codes available on Internet but most of them are in PHP and I have to encrypt data in C# windows application .Any help please.
Thank you.
|
|
|
|
|
Hi, I a trying to capture the voice using direct sound, but it is not working,here is my code can anyone help me, I will be very thankful to him.
private void CaptureThread()
{
MemoryStream inputStream = new MemoryStream(intervalSize);
while (button1.Text == "Stop")
{
bool val=bufferNotifyEvent.WaitOne();
int currentPos;
int readPos;
captureBuffer.GetCurrentPosition(out currentPos, out readPos);
inputStream.Position = 0;
captureBuffer.Read(0, inputStream, intervalSize, LockFlag.None);
outputBuffer.Write(0, inputStream, intervalSize , LockFlag.None);
outputBuffer.Play(0,BufferPlayFlags.Looping);
}
Stop();
}
the above code is the main thread that run to capture the voice, and some initializations are below
private void Form1_Load(object sender, System.EventArgs e)
{
WaveFormat waveFormat;
CaptureBufferDescription capBufDesc;
BufferPositionNotify[] notifyPositions;
bitsPerSample = 8; // 8 bits per sample
const int samplesPerSecond = 11025; // 11 KHz
const double interval = 1/45f; // Seconds
intervalSize = (int) (interval * samplesPerSecond * bitsPerSample / 8);
int samplesPerInterval = intervalSize * 8 / bitsPerSample;
int bufferSize = intervalSize * 2;
captureDevice = new Capture();
waveFormat = new WaveFormat();
waveFormat.BitsPerSample = bitsPerSample;
waveFormat.SamplesPerSecond = samplesPerSecond;
waveFormat.Channels = 1;
waveFormat.AverageBytesPerSecond = bitsPerSample * samplesPerSecond / 8;
waveFormat.BlockAlign = (short)(bitsPerSample / 8);
waveFormat.FormatTag = WaveFormatTag.Pcm;
capBufDesc = new CaptureBufferDescription();
capBufDesc.Format = waveFormat;
capBufDesc.BufferBytes = bufferSize;
captureBuffer = new CaptureBuffer(capBufDesc, captureDevice);
bufferNotify = new Notify(captureBuffer);
bufferNotifyEvent = new AutoResetEvent(false);
notifyPositions = new BufferPositionNotify[2];
notifyPositions[0] = new BufferPositionNotify();
notifyPositions[0].EventNotifyHandle = bufferNotifyEvent.Handle;
notifyPositions[0].Offset = intervalSize - (bitsPerSample / 8);
notifyPositions[1] = new BufferPositionNotify();
notifyPositions[1].EventNotifyHandle = bufferNotifyEvent.Handle;
notifyPositions[1].Offset = bufferSize - (bitsPerSample / 8);
bufferNotify.SetNotificationPositions(notifyPositions);
BufferDescription outputBufferDescription;
outputDevice = new Device();
outputDevice.SetCooperativeLevel(this, CooperativeLevel.Normal);
outputBufferDescription = new BufferDescription(waveFormat);
outputBufferDescription.BufferBytes =(int)(intervalSize*1.5f-50);
outputBufferDescription.ControlVolume = true;
outputBufferDescription.GlobalFocus = true;
outputBuffer = new SecondaryBuffer(outputBufferDescription, outputDevice);
}
all the initialization in done in Load_page and the thread will run the user will press the button, but no voice is captured, plz guide me, I will be thankful to u,
|
|
|
|
|
Hi,
I have a question on sql writing
for a table schema as below
Table :
(studentID, studentName, courseID, classID, Age)
What is the correct sql of " select studentID from table where classID = "101" and group by courseID and order by age " ? (ie. Group by courseID, and within the same courseID, the studentID are ordered by age)
Thanks
|
|
|
|
|
I might have this wrong after a few beers, but:
SELECT studentID FROM Table
WHERE classID = '101'
GROUP BY studentID, courseID
ORDER BY Age
Hope that helps
Jon Humphreys
ActivePlanet Software
Bangkok, Thailand
|
|
|
|
|
what is the complete code for downloading a file using FTP through ASP.NET/C#
-- modified at 1:50 Friday 11th November, 2005
|
|
|
|
|
Perhaps FileWebRequest [^] will provide the answer?
I assume you could replace the file:// protocol with ftp:// . If you need to supply a username and password, use the form ftp://username:password@somewhere.com .
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi guys,
I don't know why this error below keeps popping-up when I try to run my application and crashes.
Anybody seen this before? The application autoruns when the Windows startup.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.NotifyIcon.WndProc(Message& msg)
at System.Windows.Forms.NotifyIconNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Thanks guys.
|
|
|
|
|
Im going to take a wild stab in the dark
nosferatu2000 wrote: System.NullReferenceException: Object reference not set to an instance of an object.
You have an object somewhere, which you try to call a method on, however that object is Null.
Null Reference exceptions are pretty cut and dry... not really that much ambiguity except maybe WHAT is actually null.
Debug your code, step through it until this error occurs and then you'll know what is null.
|
|
|
|
|
private void Form1_Resize(object sender, System.EventArgs e)
{
if (FormWindowState.Minimized == this.WindowState)
{
this.Hide();
this.ShowInTaskbar = false;
this.Visible = false;
notify.Visible = true;
}
}
private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
{RestoreDisplay();}
private void RestoreDisplay()
{
Show();
WindowState = FormWindowState.Normal;
ShowInTaskbar = true;
this.Visible = true;
notify.Visible = false;
}
private void menuItem1_Click(object sender, System.EventArgs e)
{RestoreDisplay();}
private void menuItem2_Click(object sender, System.EventArgs e)
{Dispose(true);}
private void Form1_Load(object sender, System.EventArgs e)
{
this.Resize += new EventHandler(Form1_Resize);
notify.DoubleClick += new EventHandler(notifyIcon1_DoubleClick);
}
i'm having problems restoring it from system tray.
the display is buggy. basically what happens is that the tabs contents dont appear. sometimes the treeview contents dont appear either.
i can get it up and down fine, however making it functional seems to be a little harder.
|
|
|
|
|
I am developing a system on Visual C#. What I want to do is create an icon on my desktop that will open up my system. I also want the icon to produce a loading page and then open the first window of my system. Any ideas? Please do not tell me to google it.
|
|
|
|
|
vandread1 wrote: Please do not tell me to google it.
*grin* Now why would we say that ?
I don't get your problem - do you want to create the icon in code ? Because otherwise, it sounds like your icon will be a shortcut to your exe, surely ? How does MySQL come into this ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I accidently put mysql as the title. It doesn't have to do anything with my question. The icon is a shortcut to my exe, but I want a loading page to appear before my exe.
|
|
|
|
|
OK - so the question is, how do I get a splash screen ?
Basically, you want to store a picture in your resources for your exe, then you want to create a frameless dialog which shows the picture, and loads it from resources. Make it a member variable, call Show on it as your first step in initialisation, and then destroy it when your program is fully loaded and ready to go.
LMK if you need help with any of these steps.
Or you could use this[^] ( for what it's worth, I googled it )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I've written an ftpclient app. All it does is connects to the host uploads a file and disconnects. In my code I close the socket. However when I try to reestablish the socket connection I get this exception:
Cannot access a disposed object named System.Net.Sockets.Socket.
In my close method I'm doing this:
<br />
FTPSocket.Shutdown(SocketShutdown.Both);<br />
FTPSocket.Close();<br />
in my open I'm doing this:
<br />
IPEndPoint ipend = new IPEndPoint(Dns.Resolve(Host).AddressList[0],Port);<br />
FTPSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 60000);<br />
FTPSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 60000);<br />
FTPSocket.Connect((EndPoint)ipend);<br />
I'm not sure what I'm missing here. Any thoughts would be appreciated.
FYI I'm using an FTP class called FTPClient.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
MSDN says
The Close method closes the the remote host connection and releases all managed and unmanaged resources associated with the Socket. Upon closing, the Connected property is set to false.
I would guess that either Dispose() is being called on the socket object itself or on some object used by it internally.
I would just create a new socket object at the start of your open method. The garbage collector should clean up the previous one if it is still hanging around or you could put FTPSocket = null at the end of you're close method to be sure
|
|
|
|
|
okay this may be the dumbest question ever......but when you say create a new socket object you mean do this:
FTPClient ftpClient1 = null;
right?
I'm not up on all the terminology yet. Sorry
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Never mind I got it. Thanks for the help
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Problem with Caching mutiple ArrayLists using a ToString value for
the name. The reason I am doing this is that I Cache.Insert multiple
arrays but if they all have the same array name they will all have the
same array (i.e. last array saved). I know I can hard code every set in the database, but I'm trying to make this code Dynamic for the long run.
I cannot seem to be able to extract the value from within the
"tmpfieldName" variable when I create an ArrayList
[e.g. ArrayList tmpfieldName.ToString() = new ArrayList();]
The data that is in the the SQL table consists of 2 columns. The first
column contains a fieldname value and the second column contains the fieldCode
value. This data is used in dropdown lists within multiple web pages.
It looks like:
fieldName fieldCode
name bob
name Ron
name Chuck
hair brown
hair blond
hair grey ... and so forth.
When I use the code below it returns a "Compiler Error Message: CS1002: ; expected"."
What method should I be using to get the string value for an ArrayList name?
I have tried this using a DataSet and DataTable[index} to cache and it does the same thing.
Thanks for any ideas
--------------------- sample code to load mutilple arrays --------------------------
SqlConnection dbConnection = new SqlConnection("server=" +cServer+";database=*********;
User ID=*********; Password=********");
SqlCommand mCommand = new SqlCommand("SELECT fieldName,fieldCode FROM dbo.AaFieldCodes
ORDER BY dbo.AaFieldCodes.fieldName", dbConnection);
dbConnection.Open();
SqlDataReader mReader = mCommand.ExecuteReader(CommandBehavior.CloseConnection);
string tmpfieldName = "firstGroup";
try
{
// Iterate through all returned records
bool firstRecord = true;
while(mReader.Read())
{
if (tmpfieldName = "firstGroup")
{
tmpfieldName = mReader.GetValue(0).ToString();
ArrayList tmpfieldName.ToString() = new ArrayList();
}
if (tmpfieldName != mReader.GetValue(0).ToString())
{
_cache.Insert(tmpfieldName, tmpfieldName.ToString());
tmpfieldName = mReader.GetValue(0).ToString();
ArrayList tmpfieldName.ToString() = new ArrayList();
}
tmpfieldName.ToString().Add (mReader.GetValue(1).ToString());
}
}
finally
{
_cache.Insert(tmpfieldName, tmpfieldName.ToString());
mReader.Close();
}
|
|
|
|
|
Rlearning wrote: ArrayList tmpfieldName.ToString() = new ArrayList();
I'm confused here. What is this supposed to do ? You can't call ToString ( which returns a string ) and give it a new value, let alone a value that is not a string.
Rlearning wrote: What method should I be using to get the string value for an ArrayList name?
Do you mean the variable name ? There isn't one. And all ArrayLists have the same value coming back from ToString. If you need to give them a name, can you derive a class from ArrayList ( or is it sealed ) ? You could use containment and still impliment the right interfaces to make your class generally useful, and add a string property for a name, if that is what you need.
It looks to me like the field name is what you want to use, after building an array list of values with the same field name. You have the field name there, and you know what you want on the other end, so why not use those values, dynamically, from the data table you're looking through ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for the input.
The goal is to creat multiple arrays and store them in Cache memory. The problem I am having is with the "Cache.Insert(string, object)" Method. When I cache an array and give it a new "string" name, but use the same "object" name (ArrayList name) each time, it does not work. The results I am getting are that all Cached items point to the same "object" in memory. What it looks like to me is that the Cache.Insert does not take the array and put it in memory but rather creates a reference, like a pointer, to an existing location (object) in memory. This is why I'm trying to create a unique ArrayList name each time I create a new array. This problem also comes up when I use a DataSet and Datatables. The DataTable object reference is used by the Cache.Insert rather than the DataTable Name.
I hope I explained it so you can understand my problem.
My end goal is to take different groups of data from this SQL table and store them in different Cached items. If you have another way of doing this to achieve the same goal that would be great too.
Thanks
|
|
|
|