|
What does "doesn't work" mean? Did it throw an exception? Did it explode?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
If "sometimes it works, and sometimes it doesn't", often the timeout value is set too low.
"1 ms" is very low; the lowest useable timeout I've used with my particular setup was 250ms; with other customers needing 2000ms+, depending on the environment.
Start with a higher timeout value; using one that works most, if not all the time; then lower it to just short of where issues set in.
|
|
|
|
|
I am Working on an ASP.Net website with c#.Net as Code Behind where I need to Call a phython script which does some business logic. Can anyone please tell me how to call a phython script from ASP.Net website.
|
|
|
|
|
Try the ASP.NET forum.
Veni, vidi, abiit domum
|
|
|
|
|
Process.Start() will help you.
|
|
|
|
|
I have to host this website on IIS server.. What else I have to do to run the website..
|
|
|
|
|
Well, having python installed would be a start.
|
|
|
|
|
|
Hi everybody
I´m trying to do my own Custom Control, and I followed this helpfull tutorial
Writing your Custom Control: step by step[^]
But I have a problem, I can´t see the properties that I have created.
This is my code
Imports System.Windows.Forms
Imports System.Drawing
Imports System.ComponentModel
Imports Microsoft.VisualBasic.PowerPacks
Public Class ClaseTarjeta
Inherits RectangleShape
Private Bit As Boolean
'<Browsable(True)>
<Description("Estado del Bit")>
<Category("BITS")>
Public Property EstadoBit() As Boolean
Get
Return Bit
End Get
Set(ByVal Value As Boolean)
Bit = Value
End Set
End Property
Sub New()
End Sub
And I have in the user control that
Imports ClassTarjeta
Public Class Tarjeta
Dim bit_0 As ClaseTarjeta
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If bit_0.EstadoBit = False Then
rBit0.FillColor = Drawing.Color.Gray
Else
rBit0.FillColor = Drawing.Color.Green
End If
End Sub
Private Sub Tarjeta_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = False
Timer1.Interval = 500
End Sub
End Class
any help will be gratefull, because I don´t know what I have made wrong
Sorry for my poor english
|
|
|
|
|
Why do you have two classes and what's with the timer? This stuff doesn't make a lot of sense as written.
|
|
|
|
|
You are right!!! Sorry. I´m writing again...
Edit:
Solved, I have made only one Class, and now works!!!
modified 8-Feb-14 10:34am.
|
|
|
|
|
Hello
I need a Help on toolstrip
I have to add 1000 button contol in toolstrip. the button are added successfully but if control (item) are over flow in toolstip then the some of the control are not visible. they get hide
So I request to give some help
Thanks
|
|
|
|
|
Adding 1000 buttons to a tool strip is just plain stupid. There is no good reason to do that. As a user, I wouldn't want to go through that list of buttons.
|
|
|
|
|
hi in web application I have saved one bitmap image to serverpath and once again if i try to save another image with the same name to the same server path i am getting follwing error
'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll but was not handled in user code
Additional information: A generic error occurred in GDI+.
and also if i try to delete that image file with the same path using below code
if (System.IO.File.Exists(serpath))
{
System.IO.File.Delete(serpath);
}
it is giving The process cannot access the file serpath because it is being used by another process.
How to resolve this.i need to overwrite the image with the same name and to the same location and also delete.
how to resolve this.
if anybody knows,Please Reply me. thanks in advance.
|
|
|
|
|
|
I have tried like this copying to new bitmap then disposing old bitmap and then saving new bitmap using below code
if (System.IO.File.Exists(serpath))
{
System.Drawing.Image myimage1;
myimage1 = System.Drawing.Image.FromFile(serpath);
System.Drawing.Bitmap source_bitmap = new System.Drawing.Bitmap(myimage1);
myimage1.Dispose();
int thumb_width = 400, thumb_height = 100;
System.Drawing.Bitmap thumb_bitmap = new System.Drawing.Bitmap(thumb_width, thumb_height);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(thumb_bitmap);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.FillRectangle(System.Drawing.Brushes.White, 0, 0, thumb_width, thumb_height);
g.DrawImage(source_bitmap, 0, 0, thumb_width, thumb_height);
g.Dispose();
System.Drawing.Imaging.ImageCodecInfo[] Info = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders();
System.Drawing.Imaging.EncoderParameters Params = new System.Drawing.Imaging.EncoderParameters(1);
Params.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
thumb_bitmap.Save(serpath, Info[1], Params);
}
else
{
signatureImage.Save(serpath, ImageFormat.Jpeg);
}
but then also it is giving error 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll but was not handled in user code Additional information: A generic error occurred in GDI+ and not able to delete that file also.
how to do this. Please reply me, thanks in advance.
|
|
|
|
|
I learned something new; the BitMap(Image img) constructor does all of that painting of the source Image to a new BitMap for you. Cool!
Now for your issue. Give this a try. I rewrote the logic to get the JPEG encoder assuming that is the one you wanted. If not, it is easy to change and understand now. There should really be some handling in there in the unlikely event that the encoder does not exist. But you can add that easily enough.
if (System.IO.File.Exists(serpath))
{
System.Drawing.Image myimage1 = System.Drawing.Image.FromFile(serpath);
int thumb_width = 400, thumb_height = 100;
using (System.Drawing.Bitmap thumb_bitmap = new System.Drawing.Bitmap(thumb_width, thumb_height))
{
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(thumb_bitmap))
{
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.Clear(Color.White);
g.DrawImage(myimage1, 0, 0, thumb_width, thumb_height);
}
myimage1.Dispose();
System.Drawing.Imaging.ImageCodecInfo jpeg = default(System.Drawing.Imaging.ImageCodecInfo);
jpeg = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders().
Where((System.Drawing.Imaging.ImageCodecInfo enc) =>
enc.FormatID == System.Drawing.Imaging.ImageFormat.Jpeg.Guid)
.FirstOrDefault();
System.Drawing.Imaging.EncoderParameters Params = new System.Drawing.Imaging.EncoderParameters(1);
Params.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
thumb_bitmap.Save(serpath, jpeg, Params);
}
}
else
{
signatureImage.Save(serpath, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
|
|
|
|
|
Actually using this code the blank image is coming. Using my previous code only i am getting updated image to the same location with the same name. Only problem is after sending mail with this image iinked to the html and after html mail delivery, i am not able to again save new updated image with same name and to the same location.
How to resolve this. Please reply me. Thanks in advance.
|
|
|
|
|
hello
Please share us complete details i.e how you are displaying an images on site.
as this is due to image object is not getting null after rendring images and it is till in use at server.
|
|
|
|
|
Hello guys i have a problem. i have a datagridview with textboxes. i insert-update-delete records from database. Everything works fine. when i click on a cell in the grid. the information about this person are populated into the textboxes. but when i click on the newly inserted record it won't display the informations into texboxes. here is my code. What could the problem be?
Private Sub DataGridView1_RowEnter(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowEnter
Try
If e.RowIndex < 0 Then Exit Sub
txtserial.Text = DataGridView1.Rows(e.RowIndex).Cells(0).Value
lblcustomer.Text = "Member: " & DataGridView1.Rows(e.RowIndex).Cells("Name").Value & " " & DataGridView1.Rows(e.RowIndex).Cells("familyName").Value
Dim cmd As SqlCommand
Dim myDA As SqlDataAdapter
Dim myDataSet As DataSet
Dim strsql As String
Dim i As Integer = 0
strsql = "select * from membersvw where serial = " & Val(txtserial.Text)
cmd = New SqlCommand(strsql, mcon)
If mcon.State = ConnectionState.Closed Then mcon.Open()
myDA = New SqlDataAdapter(cmd)
myDataSet = New DataSet()
myDA.Fill(myDataSet, "membersvw")
If myDataSet.Tables("membersvw").Rows.Count > 0 Then
txtserial.Text = myDataSet.Tables("membersvw").Rows(0).Item("serial").ToString
txtname.Text = myDataSet.Tables("membersvw").Rows(0).Item("name").ToString
txtfamilyname.Text = myDataSet.Tables("membersvw").Rows(0).Item("familyname").ToString
txtphone.Text = myDataSet.Tables("membersvw").Rows(0).Item("phone").ToString
txtmobile.Text = myDataSet.Tables("membersvw").Rows(0).Item("mobile").ToString
txtfax.Text = myDataSet.Tables("membersvw").Rows(0).Item("fax").ToString
txtemail.Text = myDataSet.Tables("membersvw").Rows(0).Item("email").ToString
txtwebsite.Text = myDataSet.Tables("membersvw").Rows(0).Item("website").ToString
txtaddress.Text = myDataSet.Tables("membersvw").Rows(0).Item("address").ToString
txtspace.Text = myDataSet.Tables("membersvw").Rows(0).Item("space").ToString
cmbtimezone.Text = myDataSet.Tables("membersvw").Rows(0).Item("timezonename").ToString
End If
If TabControl1.SelectedTab.Name = "TabPage2" Then
clearcars()
fillcargrid()
ElseIf TabControl1.SelectedTab.Name = "TabPage3" Then
clearpayments()
fillpaymentgrid()
End If
myDA.Dispose()
myDataSet.Dispose()
mcon.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Thank you for your help.
modified 7-Feb-14 7:28am.
|
|
|
|
|
Did you update the database with your modified DataSet, before clicking the row that might be in your clients local cache, but not yet on the server?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hello ,
I was using a windows project developed in vb.net2003 with crystal report 9. Earlier every thing was running fine now i decided to upgrade it to vb.net2010(framework 4.0) . i convert/ upgraded the project using vs2010 after conversion every thing is running fine but i started giving me error as follows :-
""""DLL 'C:\WINDOWS\assembly\GAC\CrystalDecisions.CrystalReports.Engine\9.1.5000.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.". Please help i will like to tell you that my users for this application varies from win98 to win 7 so i think keeping crystal report 9 is mandatory.
|
|
|
|
|
|
hi
I am using json signature and trying deserialize but i am not able to deserialize. below is my json string
{"lines":[[[156.44,96.44],[156.44,95.33],[155.33,94.22],[154.22,93.11],[154.22,90.89],[153.11,89.78],[150.89,87.56],[150.89,84.22],[148.67,83.11],[147.56,80.89],[146.44,78.67],[144.22,76.44],[142,74.22],[139.78,70.89],[136.44,67.56],[134.22,65.33],[130.89,63.11],[128.67,60.89],[126.44,59.78],[124.22,57.56],[123.11,57.56],[122,56.44],[118.67,56.44],[116.44,56.44],[114.22,56.44],[112,56.44],[108.67,56.44],[105.33,56.44],[99.78,56.44],[96.44,57.56],[93.11,59.78],[89.78,60.89],[87.56,62],[86.44,64.22],[84.22,66.44],[83.11,67.56],[80.89,69.78],[79.78,70.89],[78.67,74.22],[77.56,75.33],[77.56,77.56],[77.56,79.78],[77.56,82],[77.56,84.22],[77.56,86.44],[77.56,88.67],[78.67,90.89],[78.67,93.11],[80.89,95.33],[82,97.56],[85.33,98.67],[87.56,99.78],[89.78,102],[93.11,102],[96.44,104.22],[100.89,105.33],[107.56,107.56],[114.22,108.67],[120.89,109.78],[125.33,110.89],[130.89,110.89],[134.22,112],[137.56,113.11],[139.78,114.22],[142,115.33],[143.11,115.33],[144.22,116.44],[145.33,116.44],[147.56,117.56],[147.56,118.67],[148.67,119.78],[149.78,122],[150.89,122],[150.89,124.22],[150.89,126.44],[150.89,127.56],[150.89,129.78],[150.89,132],[150.89,134.22],[149.78,135.33],[148.67,137.56],[147.56,139.78],[145.33,142],[144.22,144.22],[143.11,145.33],[139.78,146.44],[137.56,147.56],[135.33,147.56],[133.11,147.56],[129.78,147.56],[126.44,148.67],[124.22,148.67],[120.89,148.67],[118.67,148.67],[114.22,148.67],[109.78,148.67],[105.33,148.67],[102,148.67],[99.78,148.67],[97.56,148.67],[94.22,148.67],[92,148.67],[88.67,148.67],[86.44,148.67],[84.22,148.67],[83.11,148.67],[82,148.67],[79.78,148.67],[79.78,147.56],[77.56,147.56],[76.44,146.44],[75.33,146.44],[75.33,146.44],[75.33,146.44],[75.33,145.33],[74.22,145.33],[74.22,143.11],[73.11,140.89],[70.89,138.67],[70.89,137.56],[69.78,135.33],[69.78,135.33],[69.78,135.33],[69.78,133.11],[69.78,133.11],[69.78,133.11],[69.78,133.11],[69.78,132]]]}
i used code like below to deserialize
public Bitmap SigJsonToImage(string json)
{
var signatureImage = GetBlankCanvas();
if (!string.IsNullOrEmpty(json))
{
using (var signatureGraphic = Graphics.FromImage(signatureImage))
{
signatureGraphic.SmoothingMode = SmoothingMode.AntiAlias;
var pen = new Pen(PenColor, PenWidth);
var serializer = new JavaScriptSerializer();
var lines = serializer.Deserialize<list<signatureline>>(json);
foreach (var line in lines)
{
signatureGraphic.DrawLine(pen, line.lx, line.ly, line.mx, line.my);
}
}
}
return signatureImage;
}
here i am getting lines count 0 and it is not coming inside codesignatureGraphic.DrawLine
private class SignatureLine
{
public int lx { get; set; }
public int ly { get; set; }
public int mx { get; set; }
public int my { get; set; }
}
private Bitmap GetBlankCanvas()
{
var blankImage = new Bitmap(CanvasWidth, CanvasHeight);
blankImage.MakeTransparent();
using (var signatureGraphic = Graphics.FromImage(blankImage))
{
signatureGraphic.Clear(BackgroundColor);
}
return blankImage;
}
how to achieve this. anybody knows please reply me.
thanks in advance
modified 5-Feb-14 4:35am.
|
|
|
|
|