|
TheSolid wrote:
1. Is it possible to push only visual an enabled command button by programm code (not by mouse, keyboard, ...)?
Not sure about this one.
2. Is it possible to disable (Button1.Enabled = False isn't what I want) an enabled command button? This means, the command button should do no (visual) action.
You could use a simple boolean flag that wraps your code. So if the flag is set, you code will not be executed, else it will be.
|
|
|
|
|
You could perhaps catch the mouse event of the button and swallow it, using Handled = true ( if the handler has it ), to stop the base button class recieving the click event. Otherwise, Enabled = false could be all there is.
You can call a buttons event to simulate what it does, but I don't know of any way to make the button push itself visually. In both cases, an owner drawn button may be the best solution.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Dear Frinds,
Can i convert my power point presentation files into video files by any vb.net control. please help me if it is possible. Your quick response will be highly appreciated....
Thanks
Murtuza
|
|
|
|
|
There is no control that will do this for you.
What do you mean by "convert into video file"? If you're talking about converting a PowerPoint presentation into something like an .MPEG video file, then you're going to have to run it through something like MS's Windows Media Encoder, here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
There is a need for me to write an aplication to a CIC appication in IBM. It has to be in VB or VB.NET or ASP. If anyone has experiance please give me guide lines on how to start.
Mantar
|
|
|
|
|
I have been working on a problem but cant seem to find a solution. We have to read a textfile- extract the data plot them on a graph, find the centroids and so on. The file looks like this:
2.1 3.5 +1
10.2 8.3 -1
3.5 5.5 +1
9.3 7.3 -1
The first column is x, the second y, and the third tells us which class it belongs to.
Everytime I run my program it says
" An unhandled exception of type 'System.NullReferenceException' occurred in GUI-Project.exe
Additional information: Object reference not set to an instance of an object." I think the problem occurs when trying to read the data array. Could someone please show me a way??? Thanks.
I cant seem to find the solution. HEre is my code. I have a module.
Imports System.IO<br />
Imports System.Drawing<br />
<br />
Module Module1<br />
<br />
Dim projfilename As String<br />
Dim projfile As file<br />
Dim file As StreamReader<br />
Dim sentence As String<br />
Dim xsentence As Integer<br />
Dim n1, k1, n2, k2 As Double<br />
Dim data(,) As Double<br />
Dim xdata, xclass, dimdata, len, xloc, xloc1, xloc2 As Integer<br />
<br />
Public Sub setprojfileName(ByVal proj As String)<br />
projfilename = proj<br />
End Sub<br />
<br />
Public Sub paintdata(ByVal g As System.Drawing.Graphics)<br />
readFile()<br />
showDataArray()<br />
<br />
Dim r As Integer = 3<br />
Dim c0 As New Pen(Color.Green, 1)<br />
Dim c1 As New Pen(Color.Red, r)<br />
Dim c2 As New Pen(Color.Blue, r)<br />
<br />
g.DrawLine(c0, 20, 20, 20, 250)<br />
g.DrawLine(c0, 0, 250, 300, 250)<br />
<br />
n1 = k1 = n2 = k2 = 0<br />
Dim x1 As Integer = 0<br />
Dim x2 As Integer = 0<br />
<br />
Dim i As Integer<br />
For i = 0 To xdata - 1<br />
If data(i, 0) = 1 Then<br />
x1 = x1 + 1<br />
n1 += data(i, 1)<br />
k1 += data(i, 2)<br />
drawpoint(g, c1, data(i, 1), data(i, 2), r)<br />
Else<br />
x2 += 1<br />
n2 += data(i, 2)<br />
k2 += data(i, 2)<br />
drawpoint(g, c2, data(i, 1), data(i, 2), r)<br />
End If<br />
Next<br />
n1 = x1 / x1<br />
k1 = k1 / x1<br />
n2 = n2 / x2<br />
k2 = k2 / x2<br />
<br />
drawpoint(g, c0, n1, k1, r)<br />
drawpoint(g, c1, n1, k1, r - 2)<br />
drawpoint(g, c0, n2, k2, r)<br />
drawpoint(g, c2, n2, k2, r - 2)<br />
<br />
<br />
<br />
End Sub<br />
Public Sub drawpoint(ByVal g As Graphics, ByVal c As Pen, ByVal n As Double, ByVal k As Double, ByVal r As Integer)<br />
g.DrawEllipse(c, changeN(n), changeK(k), r, r)<br />
<br />
End Sub<br />
Public Function changeN(ByVal n As Double) As Integer<br />
Return n * 20<br />
<br />
End Function<br />
Public Function changeK(ByVal k As Double) As Integer<br />
Return (250 - k * 20)<br />
<br />
<br />
End Function<br />
Public Sub showDataArray()<br />
Dim i As Integer<br />
Dim da As String = "Data Array :" + Chr(13)<br />
For i = 0 To xdata - 1<br />
da += data(i, 1).ToString + " , " + data(i, 2).ToString + " , " + data(i, 0).ToString + Chr(13)<br />
Next<br />
MsgBox(da)<br />
<br />
<br />
End Sub<br />
<br />
Public Sub readFile()<br />
Try<br />
file = projfile.OpenText(projfilename)<br />
<br />
sentence = file.ReadLine()<br />
sentence.Trim()<br />
len = sentence.Length<br />
xloc = sentence.IndexOf(" ")<br />
xdata = sentence.Substring(0, xloc)<br />
dimdata = sentence.Substring(xloc, len - 1)<br />
ReDim data(xdata, dimdata)<br />
<br />
<br />
For xsentence = 0 To xdata - 1<br />
sentence = file.ReadLine()<br />
sentence.Trim()<br />
len = sentence.Length<br />
xloc1 = sentence.IndexOf(" ")<br />
xloc2 = sentence.LastIndexOf(" ")<br />
<br />
data(xsentence, 1) = sentence.Substring(0, xloc1)<br />
data(xsentence, 2) = sentence.Substring(xloc1 + 1, xloc2 - xloc1 - 1)<br />
<br />
Dim sign As String = sentence.Substring(xloc2 + 1, len - xloc2 - 1)<br />
If (sign = "+1") Then<br />
data(xsentence, 0) = 1<br />
Else<br />
data(xsentence, 0) = -1<br />
End If<br />
Next<br />
file.Close()<br />
<br />
<br />
<br />
<br />
Catch ex As Exception<br />
MsgBox("Error when reading File")<br />
<br />
End Try<br />
End Sub<br />
End Module
And I have a form:
Public Class Form1<br />
Inherits System.Windows.Forms.Form<br />
<br />
#Region " Windows Form Designer generated code "<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
OpenFileDialog1.ShowDialog()<br />
<br />
End Sub<br />
<br />
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk<br />
<br />
TextBox1.Text = OpenFileDialog1.FileName<br />
setprojfilename(TextBox1.Text)<br />
<br />
<br />
<br />
End Sub<br />
<br />
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
Dim g As System.Drawing.Graphics<br />
g = Me.panel1.createGraphics()<br />
paintdata(g)<br />
<br />
End Sub<br />
End Class
|
|
|
|
|
anybody won't help you if you post like that.
first, give the portion of code that's crashing, secondly, be more precise to where it does crash (or at least, where you think it does).
the error code you're having is because you are using a variable reference that is containing actually NULL .
what i suggest to you is to put some breakpoints, execute the code step by step, add some watches on your variables, and see which one is in default...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi gui3916boy;
The first problem is not reading the file. What is happening is that when you progeam gets to this line of code:
dimdata = sentence.Substring(xloc, len - 1)
in the try block of the readfile subroutine. The value of xloc for the first line of the data (2.1 3.5 +1) from the file is 3, the index of the first space character. The length of the data is 10. So you are attempting to get a substring starting at index 3 (the 4th character in the string) for a length of len - 1 which is 10 - 1 = 9. But from the index of 3 to the end of the string the length is only 6. You are trying to access data pass the end of the string which will throw an exception. Because this statement is in a try block you catch it and print a message that "Error when reading File" which is not the case in this example. The above statement should read as follows:
dimdata = sentence.Substring(xloc, len - xloc - 1)
this will account for not starting at the beginning of the string and also that string index start at zero and not one.
Another problem I see is that the xdata, xloc1, xloc2 and others are declared as Integer. When you read a value from the file into the integers the decimal part is truncated therefore a value from the file 2.1 becomes 2.
This should get you a little further along.
Fernando
|
|
|
|
|
hi everyone,
where am i supposed to create the publisher configuration file? in an application configuration file or xml file? what about a configuration file for trace switches? coz my program is not working properly and i'm getting error when i'm using the al.exe tool
thanks!
|
|
|
|
|
Hi,
How to create a grid where even rows will get different color?
Please help me with it , I use VB6.
Thanks a lot
|
|
|
|
|
I have a simple dataset populated from a DataAdapter connected to an ACCESS database. When I bind a textbox or a label's text property to a date field it displays the data and default time. For example: 1/12/1972 12:00:00 AM.
All I want to show the user is the date. How can I prevent the time from showing?
I have tried setting the ACCESS format for the field to Short Date and also telling the Data Adapter that the field is Date instead of DateTime, but this does not seem to be enough. My sub-records that appear in a grid show only the date just fine.
Thanks in advance for any help.
|
|
|
|
|
just create a new variable with type Date only like
Dim dte as Date
and then assign the value from Database to this variable
hope it'll work
|
|
|
|
|
Could you show the code how to asign the database value.
It seem that DataBinder.Eval(Container.DataItem, "Geboortedatum") doenst work
|
|
|
|
|
How to let the user write In numbers only in a textbox?? :-? If someone type in letter A the program will pop up a messagebox! How can i read the textbox with ASCII?
Adrian De Battista
|
|
|
|
|
|
PsYcHo_A wrote:
How to let the user write In numbers only in a textbox??
you could override the KeyPress event, with the IsNumeric() function...
PsYcHo_A wrote:
If someone type in letter A the program will pop up a messagebox!
i don't recommend you to popup a message box each time the user press a wrong key ; it will fastly become irritating to him. Prefer the error providers instead ; you could display an icon next to the control you want, without blocking the user.
PsYcHo_A wrote:
How can i read the textbox with ASCII?
use the TextBox.Text() method...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
error provider will be more sufficient . its also recommended from no. of professionals. u can search this topic from MSDN with keyword "error provider"
|
|
|
|
|
i know i know, it's what i said...
i think you told to the wrong person though
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
sorry dear . actually I wanted to tell the person who putted question there
|
|
|
|
|
Hello'
In crystal report I have used parameters list .I am assigning valuse from my code but when I open the report its promting for parameter values.
I dont want this promting beside I am passing values to parameters. any hint for solution ?
Regards
|
|
|
|
|
I am using ILMerge to merge my DLLs and it works great. I have run into my first problem unfortunately. I am creating A/V apps using DirectX 9.0c SDK for XP. This is the only SDK whose DLLs I cannot merge with my other DLLs to create a combined assembly. If I exclude the DX DLLs, ILMerge works fine. Here is the syntax I use.
c:\> ilmerge /target:library /out:test.dll Interop.Scripting.dll Microsoft.DirectX.AudioVideoPlayback.dll
If I include anyother dll besides the DirectX dll, I will get the merged DLL. If I use the DX dll, ILMerge will start and return to the prompt without creating the merged assembly.
Has anyone run into a similar problem or does any one have a possible solution to this problem?
Thanks.
|
|
|
|
|
I have never used it and don't think I ever will. But, since the AudioVideoPlayback more than likely has dependancies on other .DLL's that your not including. You'll probably also have to include the DirectX base .DLL's the managed version wrap. I think your looking at including another 6-10 .DLL's in your merge.
IMHO, I don't think it's a good idea to do this with the DirectX .DLL's. I think you'll be much better off just making a prerequisite of your application DirectX 9.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I think I might have included the DirectX base DLL but dont think that made a difference. ILMerge will just merge the DLLs, whether it fucntions or not is secondary, at the moment my concern is just the merge. I have merged all sorts of DLLs without a problem, WMP10, Scripting, Runtime, Enviroment etc. The reason I need to merge this is because I am saving my usercontrol on my flash drive and acessing my PC or laptop to futher build my user control from the flash drive. As a result, I get some dependency issues when I try to use my user control on different system besides the one it was created on.
|
|
|
|
|
Dr_Lomax wrote:
I think I might have included the DirectX base DLL
"DLL", as in singular? How about trying to include ALL the drawing .DLL's. Well, not the 3D ones anyway.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
There is a base DirectX dll and there all all the different interfaces i.e. 3D, Sound, Input etc. Eitherway adding all these additional dependency should affect the functionality of the merged DLL, not the merging process itself. I am concerned about the merging. I will add the additional assemblies when required.
|
|
|
|
|