|
I suggest seeking out new friends who know better and actually know how to write code. Your current crop of friends don't have a clue about what they're talking about.
Did you know that VB.NET and C# compile down to the same MSIL code?? Use the same libraries in the .NET Framework?? So how could one work and not the other??
|
|
|
|
|
Hi,
if you were familiar with both languages you wouldn't ask, you'd just choose yourself.
if you were familiar with just one of those languages, there would be no need to ask, use the one you know.
so start learning C#, go buy a tutorial book and study it.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
Thanks Deepak for sharing the link
|
|
|
|
|
|
Depends, have you stepped through it ? Might your midi settings be off ? I know I have a program that uses MIDI, but it doesn't play anything, I can't work out what is wrong with my MIDI settings.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Your code plays fine for me. What OS are you using? You may need to set the correct MIDIOut device in the Sound section in Control Panel. If it's Vista or Weven, it's not there so use my MIDI out setter[^] if needed.
Check the volume(s) in your mixer.
I belive from the docs (not tested), to loop, you'll need to get notification that it's finished and start it again. You do this by adding " notify" to your command and sending a pointer (could be a hwnd) or a delegate (function pointer) as the last parameter. I think the message you need is MM_MCINOTIFY (0x3B9).
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I've created a new boilerplate project, pasted and ammended your code.
This works - and loops:
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Shown += new EventHandler(Form1_Shown);
}
void Form1_Shown(object sender, EventArgs e)
{
DoPlay();
}
private const int MM_MCINOTIFY = 0x3B9;
[DllImport("winmm.dll")]
private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, uint uReturnLength, IntPtr hwndCallback);
public bool PlayMidiFile(string midiFile)
{
if (File.Exists(midiFile))
{
mciSendString("stop midi", string.Empty, 0, IntPtr.Zero);
mciSendString("close midi", string.Empty, 0, IntPtr.Zero);
mciSendString("open sequencer!" + midiFile + " alias midi", string.Empty, 0, IntPtr.Zero);
int rtn = mciSendString("play midi notify", string.Empty, 0, this.Handle);
return (rtn == 0);
}
else
return false;
}
void DoPlay()
{
PlayMidiFile(@"C:\Windows\Media\town.mid");
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == MM_MCINOTIFY)
DoPlay();
}
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
my code is
.....
Dim fs As FileStream = New FileStream(mImageFilePath.ToString(), FileMode.Open)
.....
and i can only read image from ' mImageFilePath.ToString()'. Does C# has other way such read/ stream the image from PictureBox control ?
so please tell me some guid line if u know ... thank
|
|
|
|
|
SQL Server stores bytes, so you need to save and read the bytes.
Bitmap bmp = new Bitmap( FILENAME );
MemoryStream ms = new MemoryStream();
bmp.Save( ms, SOMEIMAGEFORMAT );
byte[] imgBytes = ms.ToArray();
You can now save imgBytes to SQL using varbinary or image column types. to get it back
byte[] imgBytes = DirectCast( row["IMAGECOLUMN"], byte());
MemoryStream ms = new MemoryStream( imgBytes );
Bitmap bmp = new Bitmap( ms );
Using the wrong tool for the job is half the fun.
|
|
|
|
|
Hi all,
Is this possible that set breakpoints to all the functions inside a file? I just want to see which function is first called among many functions.
I've tried Macro recording but didn't work out.
Thanks,
|
|
|
|
|
YOu may use Call Stack [^]to determine the execution order.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Interesting question, and short of doing it manually I don't know of and doubt there is a standard way of setting breakpoints all over the shop.
I can't see how the call stack would help either, as that just tells you how the runtime got to where it is now and may not include execution branches that have already run.
Can you not just step through the code until such a function gets hit? Or, very obscure but perhaps you could intercept when the assembly is loaded which would give you an idea that one of its methos is about to be hit. I think there's an event on the AppDomain or something for that.
Regards,
Rob Philpott.
|
|
|
|
|
Breakpoints are saved in the solutionname.suo
It should be possible to use reflection to get the methods and add breakpoints accordingly.
This could be a good article topic if you succeed!
[Edit] This[^] might be a good starting point for working with the suo file [/Edit]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
modified on Thursday, June 11, 2009 4:46 AM
|
|
|
|
|
Macro recording won't work, but you can write a macro that does the job. Here's what I came up with - it basically goes to each method in the currently open file and adds a breakpoint to the first line of the method.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Public Module Module1
Public Sub AutoBreakPoint()
ProcessFile()
End Sub
Function ProcessFile()
Dim selection As EnvDTE.TextSelection
Dim projectItem As ProjectItem
Dim fileCodeModel As FileCodeModel
Dim codeElement As CodeElement
Dim i As Integer
Dim currentFunction As CodeFunction
projectItem = DTE.ActiveDocument.ProjectItem
fileCodeModel = projectItem.FileCodeModel
For i = 1 To fileCodeModel.CodeElements.Count
codeElement = fileCodeModel.CodeElements.Item(i)
ProcessCodeElement(codeElement)
Next
selection = DTE.ActiveDocument.Selection
selection.SelectAll()
selection.SmartFormat()
End Function
Sub ProcessNamespace(ByVal namespaceElement As CodeNamespace)
Dim i As Integer
Dim codeElement As CodeElement
For i = 1 To namespaceElement.Members.Count
codeElement = namespaceElement.Members.Item(i)
ProcessCodeElement(codeElement)
Next
End Sub
Sub ProcessCodeElement(ByVal codeElement As CodeElement)
If codeElement.Kind = vsCMElement.vsCMElementNamespace Then
ProcessNamespace(codeElement)
ElseIf codeElement.Kind = vsCMElement.vsCMElementClass Then
ProcessType(codeElement)
ElseIf codeElement.Kind = vsCMElement.vsCMElementFunction Then
ProcessMethod(codeElement)
End If
End Sub
Sub ProcessType(ByVal typeElement As CodeClass)
Dim i As Integer
Dim codeElement As CodeElement
For i = 1 To typeElement.Members.Count
codeElement = typeElement.Members.Item(i)
If codeElement.Kind = vsCMElement.vsCMElementFunction Then
ProcessMethod(codeElement)
ElseIf codeElement.Kind = vsCMElement.vsCMElementClass Then
ProcessType(codeElement)
End If
Next
End Sub
Sub ProcessMethod(ByVal methodElement As CodeFunction)
Dim selection As EnvDTE.TextSelection
Dim editPoint As EnvDTE.EditPoint
Dim verifyPoint As EnvDTE.TextPoint
Dim endPointAbsCharOffset As Integer
Dim column As Integer
Dim methodRunNotifierSignature As String
Dim functionStartCode As String
Dim functionEndCode As String
Dim parameters As String
Dim parameter As EnvDTE80.CodeParameter2
Dim i As Integer
If methodElement.MustImplement Then
Return
End If
selection = DTE.ActiveDocument.Selection
editPoint = selection.ActivePoint.CreateEditPoint()
verifyPoint = selection.ActivePoint.CreateEditPoint()
' Move to start of method
editPoint.MoveToPoint(methodElement.GetStartPoint(vsCMPart.vsCMPartBody))
selection.MoveToPoint(editPoint)
verifyPoint.MoveToPoint(methodElement.GetStartPoint(vsCMPart.vsCMPartBody))
DTE.Debugger.Breakpoints.Add(methodElement.Name)
End Sub
End Module
|
|
|
|
|
Tried and True. Thank you very much!
Thanks,
|
|
|
|
|
hi
i developed a project in which there are ..
1)Updating the database
2)Drawing a image using graphics and save the image in jpg format
when i run the project in my system , it works
but when i setup it and deployee in client system...
it is showing error that..
1)Unable to update the database bcoz it is in read only
2)A generic error occurred in GDI+
to solve the 2nd problem, i given all Full Control/Access permission
then it is solved
how to solve the first problem
the client is not providing the permissions bcoz all the other softwares developed by other vendors are working fine with out giving any Permissions
Please can any one solve this problem ..
regards
vijay kumar D
|
|
|
|
|
vijaylumar wrote: Unable to update the database bcoz it is in read only
You should specify the exact scenario. Which database you are using (SQL Server, Access etc.)
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
|
vijaylumar wrote: I m using Ms Access
Doesn't that explain?
Your MS Access file is ReadOnly. You can not write a read only file.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
hi
Ms access file is not readonly,its both read and write.
not only Ms access , even i cant create a text file
or save a modified image
|
|
|
|
|
Hi,
I'm getting serial ports names with the following code:
System.IO.Ports.SerialPort.GetPortNames();
It gives COM1 and COM3, but the problem is, COM3 doesn't exist under "DeviceManager -> Ports".
(After restart)
Any suggestions?
I want to fly but I don't have wings
modified on Thursday, June 11, 2009 3:18 AM
|
|
|
|
|
Do you have an internal WinModem? These sometimes create a virtual COM port which will not be shown in the Device Manager. Take a look at the modem-properties in the configuration-screen.
I are troll
|
|
|
|
|
Yes, you are right.
I have hdaudio data fax modem, its port is com3, and some ports are in use (com5, com6)
But com3 is not in use.
When I pluged usb-serial adaptor in notebook, com3 is appearing under "Ports". After, I can use this port.
If modem is using or reserved (but com3 not in use) the port, how did adaptor take this port?
So, How can I get correct port list (without com3)?
Thanks...
I want to fly but I don't have wings
|
|
|
|
|
enginço wrote: So, How can I get correct port list (without com3)?
You can give System.Management a try, I have used it before to enumerate hardware. I don't know for sure whether virtual com-ports are included, and I can't test it on my own machine (at least not without installing a new com-port). You'd need to add a reference to the assembly "System.Management" to use this functionality. The code would be something like this;
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("SELECT Name FROM Win32_SerialPort");
foreach (ManagementObject mo in searcher.Get())
Console.WriteLine(mo.GetPropertyValue("Name"));
Console.ReadKey(); Alternatively, you could scan the registry. Open RegEdit and search for the friendly name of the COM-port
I are troll
|
|
|
|