|
Pete O'Hanlon wrote: he couldn't be further off the mark if he insisted the earth was flat.
Well said! We all know the earth is a cube.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Singan wrote: I'm absolutly not a expert on the subject
Singan wrote: my friends tell me that you get a lot of hangups when using multi threeds in VB.Net but never in C#.
Singan wrote: To be frank the tell me 'u get hangups multi threeding in VB.NET ... i doesn't work'
Singan wrote: So I say use C# because you probably sooner or later like to use this solutions.
There's nothing like arguing a case from a position of no knowledge. This argument is complete and utter rubbish - in fact, it's been a long time since I've heard an argument that is so completely wrong, that it has a degree in wrongness. You do know that threading is a capability of the OS (and encapsulated by the framework on top) don't you? Given that, you do know that there isn't a VB only version of the .NET runtime don't you. So, stop relying on other people to do your thinking for you, and start thinking for yourself. Any idea that starts with "this bloke told me" is almost always guaranteed to be wrong.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Singan wrote: I'm absolutly not a expert on the subject
No, and...
Singan wrote: but my friends tell me that you get a lot of hangups when using multi threeds in VB.Net but never in C#.
it appears your friends are idiots.
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
|
|
|
|
|
Christian Graus wrote: it appears your friends are idiots.
Not only his friends - I have to assume they're his frat buddies from idiots anonymous.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Oooh dear i feel like a rabbit in a wolf pit.
You are probably more or less right, I'll see to get the complete info why.. before I make a input like this again..
|
|
|
|
|
Singan wrote: To be frank the tell me 'u get hangups multi threeding in VB.NET ... i doesn't work'
The friend who told you this is most probably a high school dropout. Tell him he's wrong.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
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.
|
|
|
|