|
2 point Member
susan_151615
Joined on 09-23-2008, 5:09 AM
Posts 69
I have a datagrid with a drop down and a txtbox
The user has to fill the text box and then only he can fill the ddl
so i have written a javascript function to the ddl toche k if text box is filled or not in this manner
in code behind i have written
Private Sub dgUpdtasksave_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgUpdtasksave.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
If e.Item.ItemType = ListItemType.EditItem Then
Dim ddlStatus As DropDownListddlStatus = DirectCast(e.Item.FindControl("ddlStatus"), Web.UI.WebControls.DropDownList)
ddlStatus.Attributes.Add("onClick", "ConfirmApply();")
End If
End if
Sub
and the javascript function i have written is
function ConfirmApply() { var x = document.getElementById("txtEffort").value; if (x == "") alert("Please enter the efforts spent"); else document.Form1.submit(); }
but its not working dono why can anyone help me in this problem
|
|
|
|
|
You need to read a book on ASP.NET. Along the way, you need to learn why we have an ASP.NET forum, and try asking there.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
susan_151615 wrote: but its not working
Could you specify what you mean by "not working"? What happens exactly, and how does that differ from what you expect? Do you get any error message?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Dear Gents,
I want to create a virtual comport through vb.net coding. Please help me how can i go for it
Regards
Azeem
|
|
|
|
|
Not really possible. This requires writing driver code, which you cannot do (efficiently) in VB.NET or C#. It's best left up to VC++.
|
|
|
|
|
Hi,
I've created a custom tru Add User Control, the control is present in my
Toolbox and shows up when placed on the Form in the Designer. However if I
try to run the form I get the error 'Type MyProject.MyControl not defined'.
This must be something simple, but I cannot find it.
regards,
John
|
|
|
|
|
When I have had an issue like this with my projects, I always needed to clean up some of the Visual Studio auto-generated designer code. Make sure you build the solution, clean the solution, and re-build the solution again.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Thanks Thomas,
I can do this but it keeps comming back.
Regards John.
|
|
|
|
|
As I want to Print the Barcode(128 or 39) of the contents of a TextBox from VB.Net application, I beg to help me please.....
NB: I have tried to print the Barcode from BarTender Software. It is working ...But I need to print it from VB.Net.
Expecting Ur Kind Step by Step Procedure since I am a Beginner.
|
|
|
|
|
There are number of useful articles present on the Codeproject site itself.
Just search for articles.
|
|
|
|
|
I am using barcode image of type bitmap and have assiged to picturebox. The original image size is larger than picturebox size, so i have used the property "Sizemode=stretch" because i want the image to be displayed in picturebox size.
after doing so and trying to print the form, the quality of image present in picturebox comes out very poor,the lines of barcode look like they have got mixed with each other,image is distorted .
if i increase the size of picturebox, print is very clear, but i need to print image in small size.
may i know some solution?
modified on Saturday, November 8, 2008 9:27 AM
|
|
|
|
|
What's the component you're using to generate the barcode image?? Does this component let you specifiy the size of the image you want?? If not, I suggest looking for another component.
|
|
|
|
|
Probably that`s because the bitmap you`re loading has a different aspect ratio from the picture box ur fitting it into. Stretch means that the image will fill the container, so it your picture box has a size like Width:200, Height:150 and the barcode has let`s say Width: 100, Height: 120 it will appear disproportioned in the picture box.
One way to get around this would be this:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim _hW As Single = Me.PictureBox1.Image.Width
Dim _hH As Single = Me.PictureBox1.Image.Height
Dim ratio As Single = IIf(_hW >= _hH, _hW / _hH, _hH / _hW)
'resize image according to which is the highest ... Width or Height
If (_hW > _hH) Then
Me.PictureBox1.Image = ResizeImg(Me.PictureBox1.Image, New Size(Me.PictureBox1.Width, Me.PictureBox1.Width / ratio))
Else
Me.PictureBox1.Image = ResizeImg(Me.PictureBox1.Image, New Size(Me.PictureBox1.Height / ratio, Me.PictureBox1.Height))
End If
End Sub
Public Function ResizeImg(ByVal img As Image, ByVal size As Size) As Image
Dim bm As Bitmap = New Bitmap(img, Convert.ToUInt32(size.Width), Convert.ToUInt32(size.Height))
Dim myNewImage As Graphics = Graphics.FromImage(bm)
myNewImage.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
Return bm
End Function
The above code assumes that the barcode image is loaded in the picturebox at runtime. You can modify the code to fit ur exact needs moving the Form1_Load code to the place in code where u need it.
If the program that generates your barcodes allows it, try increasing the HEIGHT of the bars to fit into the picture boxes aspect ratio.
|
|
|
|
|
I tried the code you have given but the image is still not clear.
Can this happen beacause of Virus? My system is badly infected.
modified on Sunday, November 9, 2008 11:41 PM
|
|
|
|
|
Hi Friends I am Converting my VB6 project into VB.net but I an able to convert these lines of code into VB.net Some body plz help me...
UnRGB picImage.Point(r, c), clrr, clrg, clrb
where r c can be any point related to x,y
Private Sub UnRGB(ByVal color As OLE_COLOR, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
r = color And &HFF&
g = (color And &HFF00&) \ &H100&
b = (color And &HFF0000) \ &H10000
End Sub
WHERE THE PROBLEM IS THIS THAT OLE_COLOR IS NOT VALID INTO VB.NET.......
Please guide me if you can
|
|
|
|
|
sarfarazaliqureshi wrote: Private Sub UnRGB(ByVal color As OLE_COLOR, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
So what does the code look like in the VB6 code that defined OLE_COLOR??
|
|
|
|
|
Actually this code is from a program Steganography.......
Private Sub EncodeByte(ByVal Value As Byte, ByVal used_positions As Collection, ByVal wid As Integer, ByVal hgt As Integer, ByVal show_pixels As Boolean)
Dim i As Integer
Dim byte_mask As Integer
Dim r As Integer
Dim c As Integer
Dim pixel As Integer
Dim clrr As Byte
Dim clrg As Byte
Dim clrb As Byte
Dim color_mask As Integer
byte_mask = 1
For i = 1 To 8
' Pick a random pixel and RGB component.
PickPosition used_positions, wid, hgt, r, c, pixel
' Get the pixel's color components.
UnRGB picImage.Point(r, c), clrr, clrg, clrb
If show_pixels Then
clrr = 255
clrg = clrg And &H1
clrb = clrb And &H1
End If
' Get the value we must store.
If Value And byte_mask Then
color_mask = 1
Else
color_mask = 0
End If
' Update the color.
Select Case pixel
Case 0
clrr = (clrr And &HFE) Or color_mask
Case 1
clrg = (clrg And &HFE) Or color_mask
Case 2
clrb = (clrb And &HFE) Or color_mask
End Select
' Set the pixel's color.
picImage.PSet (r, c), RGB(clrr, clrg, clrb)
byte_mask = byte_mask * 2
Next i
End Sub
Private Sub PickPosition(ByVal used_positions As Collection, ByVal wid As Integer, ByVal hgt As Integer, ByRef r As Integer, ByRef c As Integer, ByRef pixel As Integer)
Dim position_code As String
On Error Resume Next
Do
' Pick a position.
r = Int(Rnd * wid)
c = Int(Rnd * hgt)
pixel = Int(Rnd * 3)
' See if the position is unused.
position_code = "(" & r & "," & c & "," & pixel & ")"
used_positions.Add position_code, position_code
If Err.Number = 0 Then Exit Do
Err.Clear
Loop
End Sub
Private Sub UnRGB(ByVal color As OLE_COLOR, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
r = color And &HFF&
g = (color And &HFF00&) \ &H100&
b = (color And &HFF0000) \ &H10000
End Sub
|
|
|
|
|
This is all and wel and good, but you didn't answer the question. Where is the VB6 code that defines OLE_COLOR???
|
|
|
|
|
Since your code looks like ...
UnRGB picImage.Point(r, c), clrr, clrg, clrb
where r c can be any point related to x,y
Private Sub UnRGB(ByVal color As OLE_COLOR, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
Edited: taking a 2nd look it should be like this:
dim bm as Bitmap = new Bitmap("your picimage");
dim cr as Color = bm.GetPixel(x,y);
UnRGB (cr, clrr, clrg, clrb)
Private Sub UnRGB(byval cr as Color ...
OLE_COLOR is nothing more than a INT32 value replace in .NET by System.Drawing.Color
You can always use System.Drawing.ColorTranslator.FromOle to convert OLE_COLOR to a .NET Color Object.
Hope it helps.
modified on Saturday, November 8, 2008 5:23 PM
|
|
|
|
|
Thanks Friend Your Reply Really Helped Me thanks Alot.....
|
|
|
|
|
Actually this code is from a program Steganography.......
and I am unable to Write UnRGB procedure in Vb.net b/c if I convert OLE_COLOR into SYSTEM.DRAWING.COLOR then Error Comes that: And operation can not be performed...... any body can help me to write this procedure in Vb.net
Private Sub EncodeByte(ByVal Value As Byte, ByVal used_positions As Collection, ByVal wid As Integer, ByVal hgt As Integer, ByVal show_pixels As Boolean)
Dim i As Integer
Dim byte_mask As Integer
Dim r As Integer
Dim c As Integer
Dim pixel As Integer
Dim clrr As Byte
Dim clrg As Byte
Dim clrb As Byte
Dim color_mask As Integer
byte_mask = 1
For i = 1 To 8
' Pick a random pixel and RGB component.
PickPosition used_positions, wid, hgt, r, c, pixel
' Get the pixel's color components.
UnRGB picImage.Point(r, c), clrr, clrg, clrb
If show_pixels Then
clrr = 255
clrg = clrg And &H1
clrb = clrb And &H1
End If
' Get the value we must store.
If Value And byte_mask Then
color_mask = 1
Else
color_mask = 0
End If
' Update the color.
Select Case pixel
Case 0
clrr = (clrr And &HFE) Or color_mask
Case 1
clrg = (clrg And &HFE) Or color_mask
Case 2
clrb = (clrb And &HFE) Or color_mask
End Select
' Set the pixel's color.
picImage.PSet (r, c), RGB(clrr, clrg, clrb)
byte_mask = byte_mask * 2
Next i
End Sub
Private Sub PickPosition(ByVal used_positions As Collection, ByVal wid As Integer, ByVal hgt As Integer, ByRef r As Integer, ByRef c As Integer, ByRef pixel As Integer)
Dim position_code As String
On Error Resume Next
Do
' Pick a position.
r = Int(Rnd * wid)
c = Int(Rnd * hgt)
pixel = Int(Rnd * 3)
' See if the position is unused.
position_code = "(" & r & "," & c & "," & pixel & ")"
used_positions.Add position_code, position_code
If Err.Number = 0 Then Exit Do
Err.Clear
Loop
End Sub
Private Sub UnRGB(ByVal color As OLE_COLOR, ByRef r As Byte, ByRef g As Byte, ByRef b As Byte)
r = color And &HFF&
g = (color And &HFF00&) \ &H100&
b = (color And &HFF0000) \ &H10000
End Sub
|
|
|
|
|
Hi I m cs std. I m trying to do the Draw chat in AxMSChart control using timer control.When I m moving one y1 axes it will work perfectly when i m trying to do 2 line then bug will come. plz some help me...
This is code I m using.
Dim count As Integer = 1
Dim count1 As Integer = 1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
MSChart1.Column = 1
If count < 500 Then
MSChart1.Data = 800
ElseIf count < 1000 Then
MSChart1.Data = 900
ElseIf count < 1500 Then
MSChart1.Data = 1000
Else
MSChart1.Data = 1100
End If
count = count + 1
MSChart1.Column = 2
If count1 < 500 Then
MSChart1.Data = 1100
ElseIf count1 < 1000 Then
MSChart1.Data = 1000
ElseIf count1 < 1500 Then
MSChart1.Data = 900
Else
MSChart1.Data = 800
End If
count1 = count1 + 5
End Sub
Timer interval is 1000.
any ans send to this E-mail ID <osrnananda@rediffmail.com>
|
|
|
|
|
osrnananda wrote: When I m moving one y1 axes it will work perfectly when i m trying to do 2 line then bug will come
And that bug would be .....???
|
|
|
|
|
I m using Line Chart. When I run code using y1 axes it work correctly but when i try to run both it shows like bar or similarly like bar chart. So plz give me a solution Thanx's
|
|
|
|
|
How do i remove this thing!
I created my crystal report via the wizard.
|
|
|
|
|