|
I am creating dynamic controls from the database in an MVC application.
I have multiple properties of a material stored in the database from which different controls are displayed. The values of these properties should be taken as user input and stored in database again.
Suppose, these controls are x number of textboxes. Then which is the best way to process these data as rows and insert it to database.
Thank you.
|
|
|
|
|
a classic database is row based, so you have to process is by row
unless all the rows have a common change
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
hi
i have this code for printing, and i need to make height the font.
how to do it ?
ev.Graphics.DrawString("MyText", new Font("Arial", 10, FontStyle.Bold), new SolidBrush(Color.Black), new PointF(15,125));
thanks
|
|
|
|
|
What does "make height the font" mean?
If you want to make the font bigger, just pass a bigger point size to the constructor:
ev.Graphics.DrawString("MyText", new Font("Arial", 18, FontStyle.Bold), new SolidBrush(Color.Black), new PointF(15, 125));
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If I understand correctly, you would just have to increase the 10 in there, which is the font height, to something bigger.
I suggest to use disposable resources, like Font and SolidBrush in this case, in using-blocks, like so:
using (var arial20Bold = new Font("Arial", 20, FontStyle.Bold))
using (var solidBlack = new SolidBrush(Color.Black))
{
ev.Graphics.DrawString("MyText", arial20Bold, solidBlack, new PointF(15, 125));
}
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
thanks for the help,
i need only increase the height.
how to do it ?
thanks
|
|
|
|
|
The previous post showed you how to do it, use a larger number for font size.
|
|
|
|
|
Width/height ratio of a char is fixed. If you make it "higher", you also make it "wider".
You could draw the string on a canvas, and copy that part of the image to another image with the same width, larger height, and stretch it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
hello i want to run a text file with my audio file how?
|
|
|
|
|
Your question makes no sense at all.
Are you saying that you want to take a text file and run it through a text-to-speech engine in the application that you're writing?
|
|
|
|
|
the sample class
public class Foo{
public string Name {get;set;}
public bool IsLocked {get;set;}
public double LockID {get;set;}
}
and i have this method
public dictionary<string, object> GetSettings()
{
return somethig;
}
then when i access it like this
var sample = new Foo();
var prop = sample.GetType();
foreach(var item in GetSettings())
{
prop.GetProperty(item.key, BindingFlags.public | BindingFlags.Instance).SetValue(prop, item.Value, null)
}
then i got an exception "Object does not match target type"
I cant find any solution on the web
I will appreciate for any advice will come
thank you
|
|
|
|
|
Means that the type which the property expects is different from the type you are putting in there.
You've got a lot going on in a single line of reflection, I'd recommend to break it up in atomic statements; first get the property and put that in a PropInfo. Check if you found it, and then assign a value. Makes debugging a lot easier.
By the looks, I'd say the the boolean and the double are being fed strings.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I just discard the reflection, i found no benefit using the reflection for that method other than writing a less code.
|
|
|
|
|
hi all, i created a login form/pos system, so far its goin good yet somehow i did something wr0ng, everything works perfectly and then all of a sudden i get a message (paste it below) yet i didnt make any changes or nothing
error: i get 2 errors and 10 warnings
------""" Could not copy "obj\Debug\login form.exe" to "bin\Debug\login form.exe". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\Debug\login form.exe' because it is being used by another process. login form""""""""""---------- although it states its used by another program-it isnt any ideas?
I Checked in the task manager under processes tab / nothing there of login form.exe
|
|
|
|
|
Are you sure you haven't left something running in the background - e.g. stopping the program in the debugger and then trying to run it again?
Try closing Visual Studio and opening it again. Try Cleaning the project - or manually deleting the contents of the bin\Debug (or bin\Release) folder
|
|
|
|
|
nope , killed all processes, tried cleaning , if i restart its fixed until i debug / run it more than 2 times, so it somehow stays open while hiding itself i guess, because in the task manager theres nothing, neither in processes
|
|
|
|
|
Is it using a resource that isn't being disposed of properly?
|
|
|
|
|
im still new to most of this, how would i check to see if its using a resource thats not disposed of properly??
|
|
|
|
|
Review your code
For example, have you opened a connection to a database without using using or closing the connection when you're finished with it? Ditto using Excel/Word via interop.
The only other thing I can suggest is comment out tracts of code, prove the problem has gone away, then uncomment a section, run again ... repeat until the problem re-occurs and you will have at least located the section causing the issue.
There was a version of VS I used a few years ago that kept leaving the vhost in Task Manager - I had a pre-compile step that killed the process. The problem went away after the latest patches were applied, so make sure you have applied all of the patches (if any) for your version of VS
|
|
|
|
|
thanks ill get back to double checking right away and ill also check for available patches. thanks alot,also im using the VS 2015 RC edition if thats worth something 
|
|
|
|
|
Far more recent than the version that gave me grief In which case, check that code. Good luck
|
|
|
|
|
i fixed it but dont know what is the problem, basicly the program stayed open even after using the red x to close it, so i created a button with the aplication.close(); ,,, its a workaround until i get the real problem
|
|
|
|
|
I get this all the time and assume it is a bug in VS, closing VS usually clears the connection. It is a PITA but I live with it!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi i want to create a inventory management system,
my problem is in sql server 2012 , i created a database, i created a table named
products(varchar (50))
in my form c# i have a quantity/name/code/cost price/sell price / and a add button, how do i get those datastructure into sqls
|
|
|
|
|
jamesmc1535 wrote: i created a table named products(varchar (50)) That is not the way to create tables. A table should contain columns which relate to the data items, i.e. quantity/name/code/cost price/sell price etc. There are many samples and tutorials at http://www.codeproject.com/Chapters/4/Database.aspx[^] which will help you.
|
|
|
|