Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all 8156 articles
Browse latest View live

Application crashes with Fault Module Name:clr.dll

$
0
0

  Hello,

  I have implemented static library with clr support. After installing .Net Framework 4.0, application is crashing with below errors. Please let me know how to resolve this issue.

clr.dll

000183b4

104c
01ce8852a93e391c
C:\Program Files
(x86)\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe
C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll

eda982dc-f445-11e2-92f6-782bcba54c32


bitmap save jpeg failled but png is ok because of the comments property

$
0
0

Question Description:

when I save the bitmap to a JPEG file with JPEG format mode, a Gdi exception was thrown. But when i save it with a PNG format mode, it can be saved successfully.

Quick Recreate:

  1. Please save the images to .jpg file from the broswer. click here: IncorrectImageCorrectImage.(actually, in our application, we request the image on the fly and then save the image to JPEG.)

  2. using the below code to see the exception:

    string newFile = @"D:\Temp\newImage.jpg"; var newBitmap = Image.FromFile(@"D:\Temp\IncorrectImage.jpg"); newBitmap.Save(newFile,System.Drawing.Imaging.ImageFormat.Jpeg);

What i found:

after a deep investigation, i found out the root of the issue is from the Comments property of the orginal image. when i delete the the property value, the error disappears. Besides, after i just copy the value of the comments value of the image to notepad and then paste back, the image can be saved into a new image with the upper code and the size of the image even is larger! 


More try:

I try the below code:

//foreach (var item in newBitmap.PropertyItems)//{//    if (item.Id == 37510)//    {//        item.Value = null;//        item.Len = 0;//    }//}
        newBitmap.RemovePropertyItem(37510);
        newBitmap.Save(newFile,System.Drawing.Imaging.ImageFormat.Jpeg);

if I remove the property item, then the newimage can be saved successfully. However, if I just set its value null like the comment out codes, the exception is still thrown.

Please help me:

  • Why the image size is larger(orginal size is 48k, after cut and paste back it's about 78k) when I just clear the comments and then paste the same value back. Is it possible a bug?
  • Why the image can be saved successfully after I clear the comments and then paste the same value back? is it the Clipboard filter some invalid charactors?
  • Why the image still cann't be saved even I have set the comments property value is null? but if I remove the property, it can work, like the before i try?

Hope you can help me find out the root of the issue. we have been troubled with 2 days.

Thanks in advanced!

.dll is failed to load or could not be located in the dynamic link library.

$
0
0
I was talking on skype and playing a game at the same time, when my PC started to work very loudly, i coulnd not do anything and pressed "Restart" button. When my computer turned on, windowns dropped me an error "The procedure entry point qa%.}♀žGGt„   ž"!!dmó$|    Į┘me÷< could not be located in the dynamic link library msvcrt.dll." This error is showing himself every time when i turn on my c, please can you help me?

GeoCoorinateWatcher - Get GEO location details periodically in windows service

$
0
0

Hi,

I want to get the machine's GPs latitude and longitude values periodically using windows service c#.

I use the below code

publicvoidGetGeoProperites(){try{
                log.Debug("~: GetGeoProperites()");
                latitude =0.0;
                longitude =0.0;

                gwatcher.StatusChanged+=newEventHandler<GeoPositionStatusChangedEventArgs>(_gcw_StatusChanged);
                gwatcher.PositionChanged+=newEventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(_gcw_PositionChanged);
                gwatcher.MovementThreshold=50;//metres
                gwatcher.Start();

                log.Debug("~: latitude: "+ latitude);
                log.Debug("~: longitude: "+ longitude);}catch(Exception ex){
                log.Error("~: Exception : GetGeoProperites: "+ ex.Message);}}publicvoid _gcw_StatusChanged(object sender,GeoPositionStatusChangedEventArgs e){
            log.Debug("~: _gcw_StatusChanged()");if(e.Status==GeoPositionStatus.Ready){
                latitude = gwatcher.Position.Location.Latitude;
                latitude = gwatcher.Position.Location.Latitude;
                log.Debug("~: _gcw_StatusChanged : latitude: "+ latitude);
                log.Debug("~: _gcw_StatusChanged : longitude: "+ longitude);}}publicvoid _gcw_PositionChanged(object sender,GeoPositionChangedEventArgs<GeoCoordinate> e){try{
                log.Debug("~: _gcw_PositionChanged()");
                longitude = e.Position.Location.Longitude;
                latitude = e.Position.Location.Latitude;
                log.Debug("~: latitude: "+ latitude);
                log.Debug("~: longitude: "+ longitude);

                geoMessage.GPSLatitude= latitude;
                geoMessage.GPSLongitude= longitude;
                log.Debug("~: _gcw_PositionChanged(): Latitude = "+ latitude);
                log.Debug("~: _gcw_PositionChanged(): longitude = "+ longitude);string sFileUpload = appConfig["HsdUploadDirectoryName"].ToString()+ getGeoFileName();
                log.Debug("~: _gcw_PositionChanged(): sFileUpload = "+ sFileUpload);
                log.Debug("~: _gcw_PositionChanged(): localGeoPropFilePath = "+ localGeoPropFilePath);
                log.Debug("~: _gcw_PositionChanged(): Creating the file "+ localGeoPropFilePath);
                geoMessage.ToTabDiskFile(localGeoPropFilePath);
                log.Debug("~: _gcw_PositionChanged(): Creating the file "+ sFileUpload);
                geoMessage.ToTabDiskFile(sFileUpload);
                log.Debug("~: _gcw_PositionChanged(): Uploading to AWS");UploadToAWS();
                bUploadToAWS =true;}catch(Exception ex){
                log.Error("~: Exception : _gcw_PositionChanged: "+ ex.Message);}}
This function is called in a timer control elapsed event. The 'Postionchanged' event is never getting fired. If I call this function outside the timer event, it gets called. Please help me on this.

Facing problem while archiving to tgz SharpZipLib_

$
0
0

I want to archive content of a folder to a tgz file. I am using SharpZipLib for the same. I am able to create the file, but the problem what I am facing is , it is archiving from the root folder of source folder. If my source folder is in D:\Test\Input, it is archiving from d drive itself.

 

But what i want is , it should archive from source directory only , for reference i am pasting my code here. 

private void CreateTar()
        {
            using (FileStream fs = new FileStream("D:\\Temp\\"+string.Format(FileNameFormat,1), FileMode.Create, FileAccess.Write, FileShare.None))
            using (Stream gzipStream = new GZipOutputStream(fs))
            using (TarArchive tarArchive = TarArchive.CreateOutputTarArchive(gzipStream))
            {
                AddDirectoryFilesToTar(tarArchive, "D:\Test\Input", true);
            }
        }

 private void AddDirectoryFilesToTar(TarArchive tarArchive, string sourceDirectory, bool recurse)
        {
            // Recursively add sub-folders
            if (recurse)
            {
                string[] directories = Directory.GetDirectories(sourceDirectory);
                foreach (string directory in directories)
                    AddDirectoryFilesToTar(tarArchive, directory, recurse);
            }

            // Add files
            string[] filenames = Directory.GetFiles(sourceDirectory);
            foreach (string filename in filenames)
            {
                TarEntry tarEntry = TarEntry.CreateEntryFromFile(filename);                
                tarArchive.WriteEntry(tarEntry, true);
            }
        }

Thanks,

RP


Riju Parayidayil

error handling now working: page_error not called

$
0
0

Hi

i copied this

http://msdn.microsoft.com/en-us/library/bb397417(v=vs.100).aspx

into visual studio 2010 but it is not working! on debugging the debugger breaks into code to show where exception was thrown instead the application should redirect to default  custom error page etc;

the same thing happened in a second  ajax app and again page_error was not fired

it seems i need to configure internet explorer but that either did not solve the problem

any ideas what steps to take to make the app work will be appreciated

Missing cscomp.dll file

$
0
0

Hello,

I am getting an error when trying to run an application "The application has failed to start because cscomp.dll was not found."

Reinstalling the application does not help. I am running the app on Windows XP 32 bit SP3. Any help would be greatly appreciated.

Thanks!

DataGridView RowVlaidating fires on form load...

$
0
0

I am trying to validate the data on a row of a DataGridView by using the RowValidating event.

The problem I am having is that it fires when the form loads and any existing rows that fail my tests cause an error when my code hits e.Cancel = true;

What is the workaround for this?

Thanks!


Newark IT Guy...


Oracal и C#

$
0
0
Здравствуйте, проблема у меня такова, есть большая база данных(Oracal), мне нужно чтобы когда контроллер закинул данные в базу, то в программу на шарпе пришло "уведомление", конечно можно чтобы шарп это проверял постоянно, но так не рекомендуется делать... подскажите пожалуйста оптимальное решение.

Webrowser Leaks Memory

$
0
0

It seems conclusive from my tests and others, that there is a memory leak when using the WebBrowser Control

Microsoft, do you intend to fix this?

what happened to FederatedClientCredentialsSecurityTokenManager class in 4.5 .Net framework?

$
0
0
Looking for the namespace location for FederatedClientCredentialsSecurityTokenManager in 4.5 Framework.

HELP! Tile editor error.

$
0
0

Hi,

I'm working on a tile editor with SlimDX and VB.Net. I keep getting this weird error on the line in Form1.vb that says :

Bitmaps(b, a).FromBitmap(MyBitmap, New Point(0, 0), New Retangle(a * Width, b * Height, Width, Height))

when I click on add in the context menu in the tilesets list view. The error is : "An invalid parameter was passed to the returning function.". Here's my code:

Form1.vb:

Imports SlimDX

Public Class Form1
    Dim TileX As Integer = 0
    Dim TileY As Integer = 0
    Structure Layer
        Dim Name As String
        Sub New(Name As String)
            Me.Name = Name
        End Sub
    End Structure
    Structure Tileset
        Dim Name As String
        Dim Bitmaps As Array
        Sub New(Name As String, Bitmaps As Array)
            Me.Name = Name
            Me.Bitmaps = Bitmaps
        End Sub
    End Structure
    Public Layers As New List(Of Layer)
    Public Tilesets As New List(Of Tileset)
    Function ConvertGDIBitmapToDirect2DBitmap(MyBitmap As Bitmap, WindowRenderTarget As Direct2D.WindowRenderTarget) As Direct2D.Bitmap
        Dim MyBitmapData As Imaging.BitmapData = MyBitmap.LockBits(New Rectangle(0, 0, MyBitmap.Width, MyBitmap.Height), Imaging.ImageLockMode.ReadWrite, Imaging.PixelFormat.Format32bppPArgb)
        Dim MyDataStream As New DataStream(MyBitmapData.Scan0, MyBitmapData.Stride * MyBitmapData.Height, True, True)
        Dim MyBitmapProperties As New Direct2D.BitmapProperties()
        MyBitmapProperties.PixelFormat = New Direct2D.PixelFormat(DXGI.Format.R8G8B8A8_UNorm, Direct2D.AlphaMode.Premultiplied)
        Dim MyDirect2DBitmap As New Direct2D.Bitmap(WindowRenderTarget, New Size(MyBitmapData.Width, MyBitmapData.Height), MyDataStream, MyBitmapData.Stride, MyBitmapProperties)
        MyBitmap.UnlockBits(MyBitmapData)
        Return MyDirect2DBitmap
    End Function
    Function SplitDirect2DBitmap(Width As Integer, Height As Integer, MyBitmap As Direct2D.Bitmap, WindowRenderTarget As Direct2D.WindowRenderTarget) As Array
        Dim Bitmaps As Array = Array.CreateInstance(GetType(Direct2D.Bitmap), CInt(Math.Floor(MyBitmap.PixelSize.Height / Height)), CInt(Math.Floor(MyBitmap.PixelSize.Width / Width)))
        Dim MyBitmapProperties As New Direct2D.BitmapProperties
        MyBitmapProperties.PixelFormat = New Direct2D.PixelFormat(DXGI.Format.B8G8R8A8_UNorm, Direct2D.AlphaMode.Premultiplied)
        For a = 0 To Math.Floor(MyBitmap.PixelSize.Width / Width)
            For b = 0 To Math.Floor(MyBitmap.PixelSize.Height / Height)
                Bitmaps(b, a) = New Direct2D.Bitmap(WindowRenderTarget, New Size(Width, Height), MyBitmapProperties)
                Bitmaps(b, a).FromBitmap(MyBitmap, New Point(0, 0), New Rectangle(a * Width, b * Height, Width, Height))
            Next
        Next
        Return Bitmaps
    End Function
    Sub DrawTransparent(Width As Integer, Height As Integer, WindowRenderTarget As Direct2D.WindowRenderTarget)
        Dim X As Integer = Math.Floor(WindowRenderTarget.PixelSize.Width / Width)
        Dim Y As Integer = Math.Floor(WindowRenderTarget.PixelSize.Height / Height)
        For a = 0 To X
            For b = 0 To Y
                If a Mod 2 = 0 Then
                    If b Mod 2 = 0 Then
                        WindowRenderTarget.FillRectangle(New Direct2D.SolidColorBrush(WindowRenderTarget, New Color4(1, 0.75, 0.75, 0.75)), New Rectangle(a * Width, b * Height, Width, Height))
                    Else
                        WindowRenderTarget.FillRectangle(New Direct2D.SolidColorBrush(WindowRenderTarget, New Color4(1, 1, 1, 1)), New Rectangle(a * Width, b * Height, Width, Height))
                    End If
                Else
                    If b Mod 2 = 0 Then
                        WindowRenderTarget.FillRectangle(New Direct2D.SolidColorBrush(WindowRenderTarget, New Color4(1, 1, 1, 1)), New Rectangle(a * Width, b * Height, Width, Height))
                    Else
                        WindowRenderTarget.FillRectangle(New Direct2D.SolidColorBrush(WindowRenderTarget, New Color4(1, 0.75, 0.75, 0.75)), New Rectangle(a * Width, b * Height, Width, Height))
                    End If
                End If
            Next
        Next
    End Sub
    Sub DrawGrid(X As Integer, Y As Integer, Width As Integer, Height As Integer, Color As Color4, WindowRenderTarget As Direct2D.WindowRenderTarget)
        For a = 0 To X
            WindowRenderTarget.DrawLine(New Direct2D.SolidColorBrush(WindowRenderTarget, Color), a * Width, 0, a * Width, Y * Height)
        Next
        For a = 0 To Y
            WindowRenderTarget.DrawLine(New Direct2D.SolidColorBrush(WindowRenderTarget, Color), 0, a * Height, X * Width, a * Height)
        Next
    End Sub
    Dim LayersFactory As Direct2D.Factory
    Dim LayersWindowRenderTargetProperties As Direct2D.WindowRenderTargetProperties
    Public LayersWindowRenderTarget As Direct2D.WindowRenderTarget
    Dim TilesetsFactory As Direct2D.Factory
    Dim TilesetsWindowRenderTargetProperties As Direct2D.WindowRenderTargetProperties
    Public TilesetsWindowRenderTarget As Direct2D.WindowRenderTarget
    Dim MainFactory As Direct2D.Factory
    Dim MainWindowRenderTargetProperties As Direct2D.WindowRenderTargetProperties
    Public MainWindowRenderTarget As Direct2D.WindowRenderTarget
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        LayersFactory = New Direct2D.Factory()
        LayersWindowRenderTargetProperties = New Direct2D.WindowRenderTargetProperties()
        LayersWindowRenderTargetProperties.Handle = SplitContainer2.Panel2.Handle
        LayersWindowRenderTargetProperties.PixelSize = SplitContainer2.Panel2.ClientSize
        LayersWindowRenderTargetProperties.PresentOptions = Direct2D.PresentOptions.None
        LayersWindowRenderTarget = New Direct2D.WindowRenderTarget(LayersFactory, LayersWindowRenderTargetProperties)
        TilesetsFactory = New Direct2D.Factory()
        TilesetsWindowRenderTargetProperties = New Direct2D.WindowRenderTargetProperties()
        TilesetsWindowRenderTargetProperties.Handle = SplitContainer3.Panel2.Handle
        TilesetsWindowRenderTargetProperties.PixelSize = SplitContainer3.Panel2.ClientSize
        TilesetsWindowRenderTargetProperties.PresentOptions = Direct2D.PresentOptions.None
        TilesetsWindowRenderTarget = New Direct2D.WindowRenderTarget(TilesetsFactory, TilesetsWindowRenderTargetProperties)
        MainFactory = New Direct2D.Factory()
        MainWindowRenderTargetProperties = New Direct2D.WindowRenderTargetProperties()
        MainWindowRenderTargetProperties.Handle = SplitContainer1.Panel2.Handle
        MainWindowRenderTargetProperties.PixelSize = SplitContainer1.Panel2.ClientSize
        MainWindowRenderTargetProperties.PresentOptions = Direct2D.PresentOptions.None
        MainWindowRenderTarget = New Direct2D.WindowRenderTarget(MainFactory, MainWindowRenderTargetProperties)
        LayersWindowRenderTarget.AntialiasMode = Direct2D.AntialiasMode.Aliased
        TilesetsWindowRenderTarget.AntialiasMode = Direct2D.AntialiasMode.Aliased
        MainWindowRenderTarget.AntialiasMode = Direct2D.AntialiasMode.Aliased
    End Sub
    Private Sub SplitContainer1_SplitterMoved(sender As Object, e As SplitterEventArgs) Handles SplitContainer1.SplitterMoved
        TabControl1.Width = SplitContainer1.Panel1.Width + 2
        ListView1.Width = SplitContainer1.Panel1.Width - 12
        ListView2.Width = SplitContainer1.Panel1.Width - 12
        If SplitContainer1.Panel2.IsHandleCreated Then
            MainWindowRenderTarget.Resize(SplitContainer1.Panel2.ClientSize)
        End If
        If SplitContainer2.Panel2.IsHandleCreated Then
            LayersWindowRenderTarget.Resize(SplitContainer2.Panel2.ClientSize)
        End If
        If SplitContainer3.Panel2.IsHandleCreated Then
            TilesetsWindowRenderTarget.Resize(SplitContainer3.Panel2.ClientSize)
        End If
    End Sub
    Private Sub SplitContainer2_SplitterMoved(sender As Object, e As SplitterEventArgs) Handles SplitContainer2.SplitterMoved
        ListView1.Height = SplitContainer2.Panel1.Height
        If SplitContainer2.Panel2.IsHandleCreated Then
            LayersWindowRenderTarget.Resize(SplitContainer2.Panel2.ClientSize)
        End If
    End Sub
    Private Sub SplitContainer3_SplitterMoved(sender As Object, e As SplitterEventArgs) Handles SplitContainer3.SplitterMoved
        ListView2.Height = SplitContainer3.Panel1.Height
        If SplitContainer3.Panel2.IsHandleCreated Then
            TilesetsWindowRenderTarget.Resize(SplitContainer3.Panel2.ClientSize)
        End If
    End Sub
    Private Sub SplitContainer2_Panel2_Paint(sender As Object, e As PaintEventArgs) Handles SplitContainer2.Panel2.Paint
        LayersWindowRenderTarget.BeginDraw()
        DrawTransparent(16, 16, LayersWindowRenderTarget)
        If Not ListView1.SelectedIndices.Count = 0 Then

        End If
        LayersWindowRenderTarget.EndDraw()
    End Sub
    Private Sub SplitContainer3_Panel2_Paint(sender As Object, e As PaintEventArgs) Handles SplitContainer3.Panel2.Paint
        TilesetsWindowRenderTarget.BeginDraw()
        DrawTransparent(16, 16, TilesetsWindowRenderTarget)
        If Not ListView2.SelectedIndices.Count = 0 Then
            For a = 0 To Tilesets(ListView2.SelectedIndices(0)).Bitmaps.GetUpperBound(0) - 1
                For b = 0 To Tilesets(ListView2.SelectedIndices(0)).Bitmaps.GetUpperBound(1) - 1
                    TilesetsWindowRenderTarget.DrawBitmap(Tilesets(ListView2.SelectedIndices(0)).Bitmaps(b, a), New Rectangle(a * 32, b * 32, 32, 32))
                Next
            Next
            DrawGrid(Tilesets(ListView2.SelectedIndices(0)).Bitmaps.GetUpperBound(1), Tilesets(ListView2.SelectedIndices(0)).Bitmaps.GetUpperBound(0), 32, 32, New Color4(1, 0.5, 0.5, 0.5), TilesetsWindowRenderTarget)
            TilesetsWindowRenderTarget.DrawRectangle(New Direct2D.SolidColorBrush(TilesetsWindowRenderTarget, New Color4(1, 0.25, 0.25, 0.25)), New Rectangle(TileX * 32, TileY * 32, 32, 32))
        End If
        TilesetsWindowRenderTarget.EndDraw()
    End Sub
    Private Sub SplitContainer1_Panel2_Paint(sender As Object, e As PaintEventArgs) Handles SplitContainer1.Panel2.Paint
        MainWindowRenderTarget.BeginDraw()
        DrawTransparent(16, 16, MainWindowRenderTarget)
        MainWindowRenderTarget.EndDraw()
    End Sub
    Private Sub ContextMenuStrip1_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening
        If ListView1.SelectedIndices.Count = 0 Then
            RemoveToolStripMenuItem.Enabled = False
            MoveUpToolStripMenuItem.Enabled = False
            MoveDownToolStripMenuItem.Enabled = False
            PropertiesToolStripMenuItem.Enabled = False
        Else
            RemoveToolStripMenuItem.Enabled = True
            If ListView1.SelectedIndices(0) = 0 Then
                MoveUpToolStripMenuItem.Enabled = False
            Else
                MoveUpToolStripMenuItem.Enabled = True
            End If
            If ListView1.SelectedIndices(0) = ListView1.Items.Count - 1 Then
                MoveDownToolStripMenuItem.Enabled = False
            Else
                MoveDownToolStripMenuItem.Enabled = True
            End If
            PropertiesToolStripMenuItem.Enabled = True
        End If
    End Sub
    Private Sub AddToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AddToolStripMenuItem.Click
        Dim Name As String = "Layer " + CStr(Layers.Count + 1)
        ListView1.Items.Add(New ListViewItem(Name))
        Layers.Add(New Layer(Name))
    End Sub
    Private Sub RemoveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RemoveToolStripMenuItem.Click
        Dim Index As Integer = ListView1.SelectedIndices(0)
        ListView1.Items.RemoveAt(Index)
        Layers.RemoveAt(Index)
    End Sub
    Private Sub MoveUpToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MoveUpToolStripMenuItem.Click

    End Sub
    Private Sub MoveDownToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MoveDownToolStripMenuItem.Click

    End Sub
    Private Sub PropertiesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles PropertiesToolStripMenuItem.Click
        LayerProperties.ShowDialog()
    End Sub
    Private Sub ContextMenuStrip2_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip2.Opening
        If ListView2.SelectedIndices.Count = 0 Then
            RemoveToolStripMenuItem1.Enabled = False
            MoveUpToolStripMenuItem1.Enabled = False
            MoveDownToolStripMenuItem1.Enabled = False
            PropertiesToolStripMenuItem1.Enabled = False
        Else
            RemoveToolStripMenuItem1.Enabled = True
            If ListView2.SelectedIndices(0) = 0 Then
                MoveUpToolStripMenuItem1.Enabled = False
            Else
                MoveUpToolStripMenuItem1.Enabled = True
            End If
            If ListView2.SelectedIndices(0) = ListView2.Items.Count - 1 Then
                MoveDownToolStripMenuItem1.Enabled = False
            Else
                MoveDownToolStripMenuItem1.Enabled = True
            End If
            PropertiesToolStripMenuItem1.Enabled = True
        End If
    End Sub
    Private Sub AddToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles AddToolStripMenuItem1.Click
        Dim Name As String = "Tileset " + CStr(Tilesets.Count + 1)
        ListView2.Items.Add(New ListViewItem(Name))
        Tilesets.Add(New Tileset(Name, SplitDirect2DBitmap(32, 32, ConvertGDIBitmapToDirect2DBitmap(New Bitmap("Tile.png"), TilesetsWindowRenderTarget), TilesetsWindowRenderTarget)))
    End Sub
    Private Sub RemoveToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles RemoveToolStripMenuItem1.Click
        Dim Index As Integer = ListView2.SelectedIndices(0)
        ListView2.Items.RemoveAt(Index)
        Tilesets.RemoveAt(Index)
    End Sub
    Private Sub MoveUpToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles MoveUpToolStripMenuItem1.Click

    End Sub
    Private Sub MoveDownToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles MoveDownToolStripMenuItem1.Click

    End Sub
    Private Sub PropertiesToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles PropertiesToolStripMenuItem1.Click
        TilesetProperties.ShowDialog()
    End Sub
    Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.SelectedIndexChanged
        SplitContainer2.Panel2.Invalidate()
    End Sub
    Private Sub ListView2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView2.SelectedIndexChanged
        SplitContainer3.Panel2.Invalidate()
    End Sub
    Private Sub SplitContainer2_Panel2_Click(sender As Object, e As MouseEventArgs) Handles SplitContainer2.Panel2.Click
        If Not ListView1.SelectedIndices.Count = 0 Then

        End If
    End Sub
    Private Sub SplitContainer3_Panel2_Click(sender As Object, e As MouseEventArgs) Handles SplitContainer3.Panel2.Click
        If Not ListView2.SelectedIndices.Count = 0 Then
            'TileX = Math.Min(Math.Floor(e.X / 32), Math.Floor(Tilesets(ListView2.SelectedIndices(0)).Bitmap.Size.Width / 32) - 1)
            'TileY = Math.Min(Math.Floor(e.Y / 32), Math.Floor(Tilesets(ListView2.SelectedIndices(0)).Bitmap.Size.Height / 32) - 1)
            TileX = Math.Min(Math.Floor(e.X / 32), Tilesets(ListView2.SelectedIndices(0)).Bitmaps.GetUpperBound(1))
            TileX = Math.Min(Math.Floor(e.Y / 32), Tilesets(ListView2.SelectedIndices(0)).Bitmaps.GetUpperBound(0))
            SplitContainer3.Panel2.Invalidate()
        End If
    End Sub
    Private Sub SplitContainer1_Panel2_Click(sender As Object, e As MouseEventArgs) Handles SplitContainer1.Panel2.Click

    End Sub
End Class

LayerProperties.vb:

Public Class LayerProperties
    Private Sub LayerProperties_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TextBox1.Text = Form1.Layers(Form1.ListView1.SelectedIndices(0)).Name
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Form1.Layers(Form1.ListView1.SelectedIndices(0)) = New Form1.Layer(TextBox1.Text)
        Form1.ListView1.Items(Form1.ListView1.SelectedIndices(0)) = New ListViewItem(TextBox1.Text)
        Me.Close()
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
End Class

TilesetProperties.vb:

Imports SlimDX

Public Class TilesetProperties
    Private Sub TilesetProperties_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TextBox1.Text = Form1.Tilesets(Form1.ListView2.SelectedIndices(0)).Name
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim OldBitmap As Direct2D.Bitmap = Form1.ConvertGDIBitmapToDirect2DBitmap(New Bitmap(TextBox2.Text), Form1.TilesetsWindowRenderTarget)
        Dim NewBitmap As New Direct2D.Bitmap(Form1.TilesetsWindowRenderTarget, New Size(Math.Ceiling(OldBitmap.PixelSize.Width / 32) * 32, Math.Ceiling(OldBitmap.PixelSize.Height / 32) * 32))
        NewBitmap.FromBitmap(OldBitmap, New Point(0, 0), New Rectangle(0, 0, OldBitmap.PixelSize.Width, OldBitmap.PixelSize.Height))
        Form1.Tilesets(Form1.ListView2.SelectedIndices(0)) = New Form1.Tileset(TextBox1.Text, Form1.SplitDirect2DBitmap(32, 32, NewBitmap, Form1.TilesetsWindowRenderTarget))
        Me.Close()
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        OpenFileDialog1.ShowDialog()
    End Sub
    Private Sub OpenFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
        TextBox2.Text = OpenFileDialog1.FileName
    End Sub
End Class

Thanks.


embedded resource confusion

$
0
0

Hi I am studying for mcts certification and this question is confusing me

"you make use of asp.net 3.5 to create a web application.you decide to add a javascrip file 
named CKScripts.js as embedded resource. this file will exist in a project subfolder named TestScripts.
the name of the application assembly is Company.the default namespace of the application is Company.Web.
Management wants you to ensure that the ScriptManager control is used toregister the script for usage in the Web application"


answer:

<ScriptManager ID=""....><scripts><asp:ScriptReference Assembly="Company" Name="Company.Web.TestScripts.CKScripts.js"/>

Ok my confusion is: if the  javascript 'file' is embedded in the assembly called 'company' then the name attribute should have been

company.ckscripts.js.... this

Name="Company.Web.TestScripts.CKScripts.js"

what does it signify?

I mean when i embed a resource like javascript is it embedded 'raw    ' or as compiled product ;


Code Access

$
0
0

Hi.

I am trying to build a system that will support code access security and i am little bit stuck on what patterns should be used to implement it.

What i am trying to do is to be able to define which users can call a function or create a class instance.
I need to grant access based on user role and on custom permissions that users will be assigned.

The system will be implemented as an Windows Service Application and users and their permissions are stored in database and not related to any windows accounts.

Anyone have a good directions on this ?

Thanks.

How to print a word document on the server from the client

$
0
0

hi everyone
i  need to print a word document on the server from client using ASP.net, i tried the next code:


ProcessStartInfo info = new ProcessStartInfo(fileCopy);
info.WindowStyle = ProcessWindowStyle.Hidden;
info.Verb = "PrintTo";
info.Arguments = "PrinterName";
Process process = Process.Start(info);
fnDeleteDocument(fileCopy);

But in my computer works well and when i put my application to the server it is not working :(

anyone know why?

Thanks in advance





New to .NET -

$
0
0
I have a Furnace Data entry application - that does add, change, delete.  Has a validation file with a furnace master.  It currently is written in java and they want it changed and written in .Net.  Since I am new to this development model, would I want to do a MVC type development?  And if yes, what <connectionStrings> would I use to connect to SQL server?

FM20.DLL not registering (Error Code 0x80040151)

$
0
0

Hello,

I apologize if I'm posting this in the wrong forum. If this is the case I'd appreciate it if someone could suggest a better place to ask this question.

I'm trying to register a FM20.DLL file on a 64bit Windows 7 Professional OS with only an industrial software package installed (ie, no Microsoft Office, only default programs that come with Windows 7). I moved it to my SysWOW64 folder and ran the command regsvr32. However I get the following error message:

The module FM20.DLL was loaded but the call to DllRegisterServer failed with error code 0x80040151

It then told me to look online for the solution but I've been unable to find any answers (or even other people questioning the error code). 

One of my searches yielded that it was a 'REGDB_E_WRITEREGDB'error meaning that I 'could not write that key to a registry'. I honestly have no idea how to resolve that, I've never addressed an issue like this before.

Does anyone have a fix for this? I'd appreciate any insight you could offer.

Error while loading Outllook

$
0
0

Hi,

I am using Microsoft.interop.outlook.dll version 14 to open my Microsoft outlook 2010 from my c#.net application. I am using below code

coutlookobject.openmailinstanace(stremailto,strin.empty,string.empty,strattachmentlist);

I have to attach one file to outlook. It used to work in MS outlook 2007 in the same way. But in 2010 it is not working. I am using visual studio 2010. It is showing as retrieving and after few seconds it is showing error cannot load.  Can any one suggest me a solution for this?

Thank you.


Serialization

$
0
0
Hi. I have a class which is not serializable but i need to serialize it in the other classes. It's possible to do for instance by name but i don't want to write additional methods in each class. Maybe there is some framework which can help in such situation? Thanks.

How do I call an IO file where application default directory exists for loading a combobox?

$
0
0

How do I call an IO file where application default directory exists for loading a combobox?

this is my current code:

Public Shared circuit As Path = "appdir\2000chevyastrovantitles.txt"

I am using a global variable class, so that I can change path names and variables for my application in one place.

Thanks, Pete



This is the complete class within the application.

 Public Class GlobalVariables




        Public Shared myyear As Integer = 2000
        Public Shared mymake As String = "Chevrolet"
        Public Shared mymodel As String = "Astro"
        Public Shared imagecount As Integer = 45
        Public Shared zoomlevel125 As Integer = 125
        Public Shared zoomlevel150 As Integer = 150
        Public Shared zoomlevel175 As Integer = 175
        Public Shared zoomlevel200 As Integer = 200
        Public Shared zoomlevel100 As Integer = 100
        Public Shared currentzoom As Integer
        Public Shared Snum As String
        Public Shared finalSerialNumber As String
        Public Shared circuit As Path = "appdir\2000chevyastrovantitles.txt"

    End Class

So I can use it here for loading a combobox:

ComboBox1.Items.AddRange(IO.File.ReadAllLines(circuit))

Thanks
Viewing all 8156 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>